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
Then by the end of the view function, remove_activities_mapping.activities.choices == add_activities_mapping.activities.choices.
Essentially, it looks like two forms of the same class necessarily have the same choices for a field, which makes it hard to reuse a field on the same page.
The text was updated successfully, but these errors were encountered:
You've set the default choices to a mutable object, a list. WTForms stores the arguments passed to fields in order to construct bound fields later. This is the same situation as a mutable default argument in a normal Python function. Don't set a default, and instead initialize choices during __init__ (or populate_activities if it will always be called).
If you have a form like so:
And a flask view like so:
Then by the end of the view function,
remove_activities_mapping.activities.choices == add_activities_mapping.activities.choices
.Essentially, it looks like two forms of the same class necessarily have the same choices for a field, which makes it hard to reuse a field on the same page.
The text was updated successfully, but these errors were encountered: