0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

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

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
``datetime.date`` object.
If no ``input_formats`` argument is provided, the default input formats are::
['%Y-%m-%d', # '2006-10-25'
'%m/%d/%Y', # '10/25/2006'
'%m/%d/%y'] # '10/25/06'
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>`.
If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`DATE_INPUT_FORMATS` if :setting:`USE_L10N` is
``False``, or from the active locale format ``DATE_INPUT_FORMATS`` key if
localization is enabled. See also :doc:`format localization
</topics/i18n/formatting>`.
``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
``datetime.datetime`` object.
If no ``input_formats`` argument is provided, the default input formats are::
['%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
'%Y-%m-%d', # '2006-10-25'
'%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>`.
If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`DATETIME_INPUT_FORMATS` if :setting:`USE_L10N` is
``False``, or from the active locale format ``DATETIME_INPUT_FORMATS`` key
if localization is enabled. See also :doc:`format localization
</topics/i18n/formatting>`.
``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
``datetime.time`` object.
If no ``input_formats`` argument is provided, the default input formats are::
'%H:%M:%S', # '14:30:59'
'%H:%M', # '14:30'
If no ``input_formats`` argument is provided, the default input formats are
taken from :setting:`TIME_INPUT_FORMATS` if :setting:`USE_L10N` is
``False``, or from the active locale format ``TIME_INPUT_FORMATS`` key if
localization is enabled. See also :doc:`format localization
</topics/i18n/formatting>`.
``URLField``
------------