@@ -97,7 +97,51 @@ Not yet documented. Please help us with new pull request.
9797
9898### DecimalField
9999
100- Not yet documented. Please help us with new pull request.
100+ - API: {class}` .db_fields.DecimalField `
101+ - Default form field class: {class}` wtforms.fields.DecimalField `
102+
103+ #### Form generation behaviour
104+
105+ From form generation side this field is pretty standard and do not use any form
106+ generation adjustments.
107+
108+ If database field definition has any of {attr}` min_value ` or {attr}` max_value ` , then
109+ {class}` ~wtforms.validators.NumberRange ` validator will be added to form field.
110+
111+ #### Examples
112+
113+ numbers_demo.py in example app contain basic non-requirement example. You can adjust
114+ it to any provided example for test purposes.
115+
116+ ##### Not limited DecimalField
117+
118+ ``` python
119+ """ numbers_demo.py"""
120+ from example_app.models import db
121+
122+
123+ class NumbersDemoModel (db .Document ):
124+ """ Documentation example model."""
125+
126+ decimal_field_unlimited = db.DecimalField()
127+ ```
128+
129+ ##### Limited DecimalField
130+
131+ ``` python
132+ """ numbers_demo.py"""
133+ from decimal import Decimal
134+
135+ from example_app.models import db
136+
137+
138+ class NumbersDemoModel (db .Document ):
139+ """ Documentation example model."""
140+
141+ decimal_field_limited = db.DecimalField(
142+ min_value = Decimal(" 1" ), max_value = Decimal(" 200.455" )
143+ )
144+ ```
101145
102146### DictField
103147
@@ -163,11 +207,101 @@ Not yet documented. Please help us with new pull request.
163207
164208# ## FloatField
165209
166- Not yet documented. Please help us with new pull request.
210+ ```{versionchanged} 2.0 .0
211+ Default form field class changed from : {class }`wtforms.fields.FloatField` to
212+ {class }`~ .fields.MongoFloatField` .
213+ ```
214+
215+ - API: {class}` .db_fields.FloatField `
216+ - Default form field class: {class}` ~.fields.MongoFloatField `
217+
218+ #### Form generation behaviour
219+
220+ For Mongo database {class}` ~.db_fields.FloatField ` special WTForm field was created.
221+ This field's behaviour is the same, as for {class}` wtforms.fields.FloatField ` ,
222+ but the widget is replaced to {class}` ~wtforms.widgets.NumberInput ` , this should make a
223+ look of generated form better. It is possible, that in some cases usage of base,
224+ {class}` wtforms.fields.FloatField ` can be required by form design. Both fields are
225+ completely compatible, and replace can be done with {attr}` wtf_field_class ` db form
226+ parameter.
227+
228+ If database field definition has any of {attr}` min_value ` or {attr}` max_value ` , then
229+ {class}` ~wtforms.validators.NumberRange ` validator will be added to form field.
230+
231+ #### Examples
232+
233+ numbers_demo.py in example app contain basic non-requirement example. You can adjust
234+ it to any provided example for test purposes.
235+
236+ ##### Not limited FloatField
237+
238+ ``` python
239+ """ numbers_demo.py"""
240+ from example_app.models import db
241+
242+
243+ class NumbersDemoModel (db .Document ):
244+ """ Documentation example model."""
245+
246+ float_field_unlimited = db.FloatField()
247+ ```
248+
249+ ##### Limited FloatField
250+
251+ ``` python
252+ """ numbers_demo.py"""
253+ from example_app.models import db
254+
255+
256+ class NumbersDemoModel (db .Document ):
257+ """ Documentation example model."""
258+
259+ float_field_limited = db.FloatField(min_value = float (1 ), max_value = 200.455 )
260+ ```
167261
168262### IntField
169263
170- Not yet documented. Please help us with new pull request.
264+ - API: {class}` .db_fields.IntField `
265+ - Default form field class: {class}` wtforms.fields.IntegerField `
266+
267+ #### Form generation behaviour
268+
269+ From form generation side this field is pretty standard and do not use any form
270+ generation adjustments.
271+
272+ If database field definition has any of {attr}` min_value ` or {attr}` max_value ` , then
273+ {class}` ~wtforms.validators.NumberRange ` validator will be added to form field.
274+
275+ #### Examples
276+
277+ numbers_demo.py in example app contain basic non-requirement example. You can adjust
278+ it to any provided example for test purposes.
279+
280+ ##### Not limited IntField
281+
282+ ``` python
283+ """ numbers_demo.py"""
284+ from example_app.models import db
285+
286+
287+ class NumbersDemoModel (db .Document ):
288+ """ Documentation example model."""
289+
290+ integer_field_unlimited = db.IntField()
291+ ```
292+
293+ ##### Limited IntField
294+
295+ ``` python
296+ """ numbers_demo.py"""
297+ from example_app.models import db
298+
299+
300+ class NumbersDemoModel (db .Document ):
301+ """ Documentation example model."""
302+
303+ integer_field_limited = db.IntField(min_value = 1 , max_value = 200 )
304+ ```
171305
172306### ListField
173307
0 commit comments