flask-mongoengine icon indicating copy to clipboard operation
flask-mongoengine copied to clipboard

allow_blank not working for StringField choices

Open spitzbubchen opened this issue 7 years ago • 1 comments

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'

spitzbubchen avatar Mar 26 '17 20:03 spitzbubchen

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)

bekab95 avatar Aug 26 '18 09:08 bekab95