I would like to create a custom SelectField
that provides different choices in based on the current date. For example, if it is the 13th of the month, the choices will be the values 1 through 13. How do I do this?
def register_extensions(app):
security.init_app(app, datastore=ds, register_form=forms.ExtendedRegisterForm)
class ExtendedRegisterForm(RegisterForm):
pay_month = SelectField(choices=[('need', 'custom'), ('day', 'choices')])
Override the form's
__init__
method and populate the field'schoices
with the range of values from 1 to the current day.