File: fields.txt

package info (click to toggle)
django-filter 25.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,228 kB
  • sloc: python: 7,970; javascript: 7,213; makefile: 157; sh: 16
file content (23 lines) | stat: -rw-r--r-- 850 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
===============
Field Reference
===============

``IsoDateTimeField``
~~~~~~~~~~~~~~~~~~~~

Extends ``django.forms.DateTimeField`` to allow parsing ISO 8601 formated dates, in addition to existing formats

Defines a class level attribute ``ISO_8601`` as constant for the format.

Sets ``input_formats = [ISO_8601]`` — this means that by default ``IsoDateTimeField`` will **only** parse ISO 8601 formated dates.

You may set ``input_formats`` to your list of required formats as per the `DateTimeField Docs`_, using the ``ISO_8601`` class level attribute to specify the  ISO 8601 format.

.. code-block:: python

    f = IsoDateTimeField()
    f.input_formats = [IsoDateTimeField.ISO_8601] + DateTimeField.input_formats


.. _`DateTimeField Docs`: https://docs.djangoproject.com/en/stable/ref/forms/fields/#django.forms.DateTimeField.input_formats