Corrected notes about default date/datetime/time input formats.

This commit is contained in:
Claude Paroz 2020-01-04 10:25:23 +01:00 committed by Mariusz Felisiak
parent 0f843fdd5b
commit b23fb2c819
1 changed files with 15 additions and 36 deletions

View File

@ -467,25 +467,11 @@ For each field, we describe the default widget used if you don't specify
A list of formats used to attempt to convert a string to a valid A list of formats used to attempt to convert a string to a valid
``datetime.date`` object. ``datetime.date`` object.
If no ``input_formats`` argument is provided, the default input formats are:: If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`DATE_INPUT_FORMATS` if :setting:`USE_L10N` is
['%Y-%m-%d', # '2006-10-25' ``False``, or from the active locale format ``DATE_INPUT_FORMATS`` key if
'%m/%d/%Y', # '10/25/2006' localization is enabled. See also :doc:`format localization
'%m/%d/%y'] # '10/25/06' </topics/i18n/formatting>`.
Additionally, if you specify :setting:`USE_L10N=False<USE_L10N>` in your settings, the
following will also be included in the default input formats::
['%b %d %Y', # 'Oct 25 2006'
'%b %d, %Y', # 'Oct 25, 2006'
'%d %b %Y', # '25 Oct 2006'
'%d %b, %Y', # '25 Oct, 2006'
'%B %d %Y', # 'October 25 2006'
'%B %d, %Y', # 'October 25, 2006'
'%d %B %Y', # '25 October 2006'
'%d %B, %Y'] # '25 October, 2006'
See also :doc:`format localization </topics/i18n/formatting>`.
``DateTimeField`` ``DateTimeField``
----------------- -----------------
@ -506,19 +492,11 @@ For each field, we describe the default widget used if you don't specify
A list of formats used to attempt to convert a string to a valid A list of formats used to attempt to convert a string to a valid
``datetime.datetime`` object. ``datetime.datetime`` object.
If no ``input_formats`` argument is provided, the default input formats are:: If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`DATETIME_INPUT_FORMATS` if :setting:`USE_L10N` is
['%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59' ``False``, or from the active locale format ``DATETIME_INPUT_FORMATS`` key
'%Y-%m-%d %H:%M', # '2006-10-25 14:30' if localization is enabled. See also :doc:`format localization
'%Y-%m-%d', # '2006-10-25' </topics/i18n/formatting>`.
'%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
'%m/%d/%Y %H:%M', # '10/25/2006 14:30'
'%m/%d/%Y', # '10/25/2006'
'%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'
'%m/%d/%y %H:%M', # '10/25/06 14:30'
'%m/%d/%y'] # '10/25/06'
See also :doc:`format localization </topics/i18n/formatting>`.
``DecimalField`` ``DecimalField``
---------------- ----------------
@ -928,10 +906,11 @@ For each field, we describe the default widget used if you don't specify
A list of formats used to attempt to convert a string to a valid A list of formats used to attempt to convert a string to a valid
``datetime.time`` object. ``datetime.time`` object.
If no ``input_formats`` argument is provided, the default input formats are:: If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`TIME_INPUT_FORMATS` if :setting:`USE_L10N` is
'%H:%M:%S', # '14:30:59' ``False``, or from the active locale format ``TIME_INPUT_FORMATS`` key if
'%H:%M', # '14:30' localization is enabled. See also :doc:`format localization
</topics/i18n/formatting>`.
``URLField`` ``URLField``
------------ ------------