Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow_blank not working for StringField choices #305

Open
spitzbubchen opened this issue Mar 26, 2017 · 1 comment
Open

allow_blank not working for StringField choices #305

spitzbubchen opened this issue Mar 26, 2017 · 1 comment

Comments

@spitzbubchen
Copy link

For a model:

class Task(db.Document):
     frequency = db.StringField(choices = (('daily', 'Daily'), ('monthly', 'Monthly'), ('yearly', 'Yearly')), verbose_name = 'Frequency')

And a form:

form = model_form(Task, FlaskForm, field_args = {
	'frequency' : { 'allow_blank': True }
})

Results in:

TypeError: __init__() got an unexpected keyword argument 'allow_blank'

@bekab95
Copy link

bekab95 commented Aug 26, 2018

you may tell blank=true in

class Task(db.Document):
     frequency = db.StringField(choices = (('daily', 'Daily'), ('monthly', 'Monthly'), ('yearly', 'Yearly')), verbose_name = 'Frequency', blank=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants