@@ -87,13 +87,169 @@ Not yet documented. Please help us with new pull request.
8787
8888Not yet documented. Please help us with new pull request.
8989
90+ ### ComplexDateTimeField
91+
92+ - API: {class}` .db_fields.ComplexDateTimeField `
93+ - Default form field class: {class}` wtforms.fields.DateTimeLocalField `
94+
95+ #### Form generation behaviour
96+
97+ ComplexDateTimeField stores date and time information in database ` string ` format. This
98+ format allow precision up to microseconds dimension.
99+
100+ Unfortunately, there is no HTML5 field, that allow so high precision. That's why, by
101+ default the generated field will use HTML5 ` <input type="datetime-local"> ` with
102+ precision set to milliseconds.
103+
104+ If you require concrete microseconds for edit purposes, please use
105+ {class}` wtforms.fields.DateTimeField ` with correct format (see examples below).
106+
107+ Field is easy adjustable, to use any other precision. Check examples and example app
108+ for more details.
109+
110+ #### Examples
111+
112+ dates_demo.py in example app contain basic non-requirement example. You can adjust
113+ it to any provided example for test purposes.
114+
115+ ##### ComplexDateTimeField with milliseconds precision
116+
117+ ``` python
118+ """ dates_demo.py"""
119+ from example_app.models import db
120+
121+
122+ class DateTimeModel (db .Document ):
123+ """ Documentation example model."""
124+
125+ complex_datetime = db.ComplexDateTimeField()
126+ ```
127+
128+ ##### ComplexDateTimeField with seconds precision
129+
130+ ``` python
131+ """ dates_demo.py"""
132+ from example_app.models import db
133+
134+
135+ class DateTimeModel (db .Document ):
136+ """ Documentation example model."""
137+
138+ complex_datetime_sec = db.ComplexDateTimeField(
139+ wtf_options = {" render_kw" : {" step" : " 1" }}
140+ )
141+ ```
142+
143+ ##### ComplexDateTimeField with microseconds precision (text)
144+
145+ ``` python
146+ """ dates_demo.py"""
147+ from wtforms.fields import DateTimeField
148+
149+ from example_app.models import db
150+
151+
152+ class DateTimeModel (db .Document ):
153+ """ Documentation example model."""
154+
155+ complex_datetime_microseconds = db.ComplexDateTimeField(
156+ wtf_field_class = DateTimeField, wtf_options = {" format" : " %Y-%m-%d %H:%M:%S.%f " }
157+ )
158+ ```
159+
90160### DateField
91161
92- Not yet documented. Please help us with new pull request.
162+ - API: {class}` .db_fields.DateField `
163+ - Default form field class: {class}` wtforms.fields.DateField `
164+
165+ #### Form generation behaviour
166+
167+ DateField is one of the simplest fields in the forms generation process. By default,
168+ the field use {class}` wtforms.fields.DateField ` WTForms class, representing a form
169+ input with standard HTML5 ` <input type="date"> ` . No custom additional transformation
170+ done, during field generation. Field is fully controllable by [ global transforms] .
171+
172+ #### Examples
173+
174+ dates_demo.py in example app contain basic non-requirement example. You can adjust
175+ it to any provided example for test purposes.
176+
177+ ``` python
178+ """ dates_demo.py"""
179+ from example_app.models import db
180+
181+
182+ class DateTimeModel (db .Document ):
183+ """ Documentation example model."""
184+
185+ date = db.DateField()
186+ ```
187+
188+ ##### Not limited DateField
189+
190+ ``` python
191+ pass
192+ ```
93193
94194### DateTimeField
95195
96- Not yet documented. Please help us with new pull request.
196+ - API: {class}` .db_fields.DateTimeField `
197+ - Default form field class: {class}` wtforms.fields.DateTimeLocalField `
198+
199+ #### Form generation behaviour
200+
201+ DateTimeField stores date and time information in database ` date ` format. This
202+ format allow precision up to milliseconds dimension. By default, generated form will
203+ use HTML5 ` <input type="datetime-local"> ` with precision set to seconds.
204+
205+ Field is easy adjustable, to use any other precision. Check examples and example app
206+ for more details.
207+
208+ It is possible to use {class}` wtforms.fields.DateTimeField ` for text input behaviour.
209+
210+ #### Examples
211+
212+ dates_demo.py in example app contain basic non-requirement example. You can adjust
213+ it to any provided example for test purposes.
214+
215+ ##### DateTimeField with seconds precision
216+
217+ ``` python
218+ """ dates_demo.py"""
219+ from example_app.models import db
220+
221+
222+ class DateTimeModel (db .Document ):
223+ """ Documentation example model."""
224+
225+ datetime = db.DateTimeField()
226+ ```
227+
228+ ##### DateTimeField without seconds
229+
230+ ``` python
231+ """ dates_demo.py"""
232+ from example_app.models import db
233+
234+
235+ class DateTimeModel (db .Document ):
236+ """ Documentation example model."""
237+
238+ datetime_no_sec = db.DateTimeField(wtf_options = {" render_kw" : {" step" : " 60" }})
239+ ```
240+
241+ ##### DateTimeField with milliseconds precision
242+
243+ ``` python
244+ """ dates_demo.py"""
245+ from example_app.models import db
246+
247+
248+ class DateTimeModel (db .Document ):
249+ """ Documentation example model."""
250+
251+ datetime_ms = db.DateTimeField(wtf_options = {" render_kw" : {" step" : " 0.001" }})
252+ ```
97253
98254### DecimalField
99255
@@ -533,10 +689,6 @@ class StringsDemoModel(db.Document):
533689
534690Not yet documented. Please help us with new pull request.
535691
536- # ## ComplexDateTimeField
537-
538- Not yet documented. Please help us with new pull request.
539-
540692# ## DynamicField
541693
542694Not yet documented. Please help us with new pull request.
0 commit comments