File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ In the template::
127127MongoEngine and WTForms
128128=======================
129129
130- You can use MongoEngine and WTForms like so ::
130+ flask-mongoengine automatically generates WTForms from MongoEngine models ::
131131
132132 from flask_mongoengine.wtf import model_form
133133
@@ -155,9 +155,28 @@ You can use MongoEngine and WTForms like so::
155155 redirect('done')
156156 return render_template('add_post.html', form=form)
157157
158+ For each MongoEngine field, the most appropriate WTForm field is used.
159+ Parameters allow the user to provide hints if the conversion is not implicit::
160+
161+ PostForm = model_form(Post, field_args={'title': {'textarea': True}})
162+
163+ Supported parameters:
164+
165+ For fields with `choices `:
166+
167+ - `multiple ` to use a SelectMultipleField
168+ - `radio ` to use a RadioField
169+
170+ For `StringField `:
171+
172+ - `password ` to use a PasswordField
173+ - `textarea ` to use a TextAreaField
174+
175+ (By default, a StringField is converted into a TextAreaField if and only if it has no max_length.)
176+
158177
159178Supported fields
160- ================
179+ ----------------
161180
162181* StringField
163182* BinaryField
@@ -175,7 +194,7 @@ Supported fields
175194* DictField
176195
177196Not currently supported field types:
178- ====================================
197+ ------------------------------------
179198
180199* ObjectIdField
181200* GeoLocationField
@@ -229,7 +248,7 @@ Upgrading
229248
230249
231250Credits
232- ========
251+ =======
233252
234253Inspired by two repos:
235254
You can’t perform that action at this time.
0 commit comments