You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to set a QuerySelectField to a the currently logged in user in the create interface. Basically I have a "created_by_user_id" column that I would like to automatically set, the default value is dependent by the currently logged in user.
So I finally got it to work, but its ugly. I had to use the User SQLAlchemy instance and override its eq to check if the id fields were equal. The part where it checks if something should be selected does == between the user object populating the form and the one stored in form.select_field.data. That fails because they are different instances. However changing the comparison operator fixes the problem in this case.
Hi, I am trying to set a QuerySelectField to a the currently logged in user in the create interface. Basically I have a "created_by_user_id" column that I would like to automatically set, the default value is dependent by the currently logged in user.
This works, the change is reflected in the generated HTML:
This does not work (no change in generated HTML, 1 is still selected by default)
I have tried all kinds of workarounds to no avail:
To me it looks like something is clearly busted here, I had to resort to handling this with Javascript.
The text was updated successfully, but these errors were encountered: