I am using the latest version of flask, wtforms and Flask-WTForms.
I have a page that displays a form and one is a select box with option option called "A".
When the app starts all is well. In a another form I add a record called "B".
Now, the form I want should have the select box wth options A and B bot only option A is available. I have to kill uWSGI and restart to get wtforms to refresh the data.
So, what am I missing? How to I get wtforms to refresh data?
Here s how I create the form where getAgencyList returns a list of options to add to the select box. In another dialogue I add an agency and the agency list should be updated without having to restart the app:
class createUser(Form):
"""
Users are given a default password
"""
first_name = TextField()
last_name = TextField()
email = TextField('Email', [validators.Length(min=6, max=120), validators.Email()])
user_role = SelectField(u'User Role', choices=[('1', 'User'), ('2', 'Admin')])
org_role = SelectField(u'User Role', choices=[('1', 'Agency'), ('2', 'Advertiser'),('3', 'Admin')])
agency = SelectField(u'Agency', choices=getAgencyList())