Fixed #2062 -- Added YEAR_MONTH_FORMAT and MONTH_DAY_FORMAT settings, and added technical message IDs of the same names. Thanks, ramiro
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3055 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1717b94fc8
commit
ab2fb1634f
|
@ -203,6 +203,16 @@ DATETIME_FORMAT = 'N j, Y, P'
|
|||
# http://www.djangoproject.com/documentation/templates/#now
|
||||
TIME_FORMAT = 'P'
|
||||
|
||||
# Default formatting for date objects when only the year and month are relevant.
|
||||
# See all available format strings here:
|
||||
# http://www.djangoproject.com/documentation/templates/#now
|
||||
YEAR_MONTH_FORMAT = 'F Y'
|
||||
|
||||
# Default formatting for date objects when only the month and day are relevant.
|
||||
# See all available format strings here:
|
||||
# http://www.djangoproject.com/documentation/templates/#now
|
||||
MONTH_DAY_FORMAT = 'F j'
|
||||
|
||||
# Whether to enable Psyco, which optimizes Python code. Requires Psyco.
|
||||
# http://psyco.sourceforge.net/
|
||||
ENABLE_PSYCO = False
|
||||
|
|
|
@ -221,10 +221,10 @@ def get_language_bidi():
|
|||
False = left-to-right layout
|
||||
True = right-to-left layout
|
||||
"""
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
return get_language() in settings.LANGUAGES_BIDI
|
||||
|
||||
|
||||
def catalog():
|
||||
"""
|
||||
This function returns the current active catalog for further processing.
|
||||
|
@ -369,7 +369,22 @@ def get_date_formats():
|
|||
datetime_format = settings.DATETIME_FORMAT
|
||||
if time_format == 'TIME_FORMAT':
|
||||
time_format = settings.TIME_FORMAT
|
||||
return (date_format, datetime_format, time_format)
|
||||
return date_format, datetime_format, time_format
|
||||
|
||||
def get_partial_date_formats():
|
||||
"""
|
||||
This function checks whether translation files provide a translation for some
|
||||
technical message ID to store partial date formats. If it doesn't contain
|
||||
one, the formats provided in the settings will be used.
|
||||
"""
|
||||
from django.conf import settings
|
||||
year_month_format = _('YEAR_MONTH_FORMAT')
|
||||
month_day_format = _('MONTH_DAY_FORMAT')
|
||||
if year_month_format == 'YEAR_MONTH_FORMAT':
|
||||
year_month_format = settings.YEAR_MONTH_FORMAT
|
||||
if month_day_format == 'MONTH_DAY_FORMAT':
|
||||
month_day_format = settings.MONTH_DAY_FORMAT
|
||||
return year_month_format, month_day_format
|
||||
|
||||
def install():
|
||||
"""
|
||||
|
|
|
@ -291,7 +291,7 @@ The default formatting to use for date fields on Django admin change-list
|
|||
pages -- and, possibly, by other parts of the system. See
|
||||
`allowed date format strings`_.
|
||||
|
||||
See also DATETIME_FORMAT and TIME_FORMAT.
|
||||
See also DATETIME_FORMAT, TIME_FORMAT, YEAR_MONTH_FORMAT and MONTH_DAY_FORMAT.
|
||||
|
||||
.. _allowed date format strings: http://www.djangoproject.com/documentation/templates/#now
|
||||
|
||||
|
@ -304,7 +304,7 @@ The default formatting to use for datetime fields on Django admin change-list
|
|||
pages -- and, possibly, by other parts of the system. See
|
||||
`allowed date format strings`_.
|
||||
|
||||
See also DATE_FORMAT and TIME_FORMAT.
|
||||
See also DATE_FORMAT, DATETIME_FORMAT, TIME_FORMAT, YEAR_MONTH_FORMAT and MONTH_DAY_FORMAT.
|
||||
|
||||
.. _allowed date format strings: http://www.djangoproject.com/documentation/templates/#now
|
||||
|
||||
|
@ -532,6 +532,23 @@ Default::
|
|||
|
||||
A tuple of middleware classes to use. See the `middleware docs`_.
|
||||
|
||||
MONTH_DAY_FORMAT
|
||||
----------------
|
||||
|
||||
Default: ``'F j'``
|
||||
|
||||
The default formatting to use for date fields on Django admin change-list
|
||||
pages -- and, possibly, by other parts of the system -- in cases when only the
|
||||
month and day are displayed.
|
||||
|
||||
For example, when a Django admin change-list page is being filtered by a date
|
||||
drilldown, the header for a given day displays the day and month. Different
|
||||
locales have different formats. For example, U.S. English would say
|
||||
"January 1," whereas Spanish might say "1 Enero."
|
||||
|
||||
See `allowed date format strings`_. See also DATE_FORMAT, DATETIME_FORMAT,
|
||||
TIME_FORMAT and YEAR_MONTH_FORMAT.
|
||||
|
||||
PREPEND_WWW
|
||||
-----------
|
||||
|
||||
|
@ -696,7 +713,8 @@ The default formatting to use for time fields on Django admin change-list
|
|||
pages -- and, possibly, by other parts of the system. See
|
||||
`allowed date format strings`_.
|
||||
|
||||
See also DATE_FORMAT and DATETIME_FORMAT.
|
||||
See also DATE_FORMAT, DATETIME_FORMAT, TIME_FORMAT, YEAR_MONTH_FORMAT and
|
||||
MONTH_DAY_FORMAT.
|
||||
|
||||
.. _allowed date format strings: http://www.djangoproject.com/documentation/templates/#now
|
||||
|
||||
|
@ -720,6 +738,23 @@ A boolean that specifies whether to output the "Etag" header. This saves
|
|||
bandwidth but slows down performance. This is only used if ``CommonMiddleware``
|
||||
is installed (see the `middleware docs`_).
|
||||
|
||||
YEAR_MONTH_FORMAT
|
||||
-----------------
|
||||
|
||||
Default: ``'F Y'``
|
||||
|
||||
The default formatting to use for date fields on Django admin change-list
|
||||
pages -- and, possibly, by other parts of the system -- in cases when only the
|
||||
year and month are displayed.
|
||||
|
||||
For example, when a Django admin change-list page is being filtered by a date
|
||||
drilldown, the header for a given month displays the month and the year.
|
||||
Different locales have different formats. For example, U.S. English would say
|
||||
"January 2006," whereas another locale might say "2006/January."
|
||||
|
||||
See `allowed date format strings`_. See also DATE_FORMAT, DATETIME_FORMAT,
|
||||
TIME_FORMAT and MONTH_DAY_FORMAT.
|
||||
|
||||
.. _cache docs: http://www.djangoproject.com/documentation/cache/
|
||||
.. _middleware docs: http://www.djangoproject.com/documentation/middleware/
|
||||
.. _session docs: http://www.djangoproject.com/documentation/sessions/
|
||||
|
|
Loading…
Reference in New Issue