WTF module API
This is the flask_mongoengine WTF module API documentation.
flask_mongoengine.wtf.fields module
Flask-mongoengine with Flask models.
Extends wtforms.fields.BooleanField. Handles None values correctly for MongoEngine boolean fields.
Extends wtforms.fields.DateField. Handles None values correctly for MongoEngine date fields.
Extends wtforms.fields.DateTimeField. Handles None values correctly for MongoEngine datetime fields.
Extends wtforms.fields.DecimalField. Handles None values correctly for MongoEngine decimal fields.
Extends wtforms.fields.EmailField. Handles None values and empty strings correctly.
Extends wtforms.fields.FileField for MongoEngine GridFS file fields.
Extends wtforms.fields.FloatField with 'numbers' input type. Handles None values correctly.
Extends wtforms.fields.IntegerField. Handles None values correctly for MongoEngine integer fields.
Extends wtforms.fields.PasswordField. Handles None values and empty strings correctly.
Extends wtforms.fields.SelectField. Used for MongoEngine fields with choices option.
Extends wtforms.fields.SelectMultipleField. Used for MongoEngine list fields with choices and multiple option.
Extends wtforms.fields.StringField. Handles None values and empty strings correctly. Used for StringField with max_length set.
Extends MongoStringField with telephone input type.
Extends wtforms.fields.TextAreaField. Default field for StringField without max_length. Handles None values and empty strings correctly.
Extends wtforms.fields.URLField. Handles None values and empty strings correctly.
Mixin that converts empty string values to None. Used as base for all Mongo string-based form fields. Can be used for custom field types.
flask_mongoengine.wtf.models module
A WTForms Form subclass with MongoEngine model support. Provides the save() method to persist form data to the database.
Save the model instance to the database.
- Parameters:
commit— IfTrue, calls.save()on the model instance before returning it.
Returns: The saved (or unsaved) model instance.
flask_mongoengine.wtf.orm module
Create a WTForms Form class from a MongoEngine Document class.
- Parameters:
model— The MongoEngine Document class.base_class— The base form class. Defaults toModelForm.only— An optional iterable with field names to include.exclude— An optional iterable with field names to exclude.field_args— An optional dictionary of field name to keyword arguments for the form field.converter— A custom field converter instance.
Returns: A ModelForm subclass.
Generate a dictionary of WTForms fields from a MongoEngine Document class. Similar to model_form but returns a field dictionary instead of a Form class.
Module contents
The flask_mongoengine.wtf package exposes the following at module level:
model_form— Generate a WTForms Form from a MongoEngine Document.model_fields— Generate WTForms fields dict from a MongoEngine Document.