=== modified file 'django/conf/global_settings.py'
|
|
|
|
| 226 | 226 | |
| 227 | 227 | # Default formatting for date objects. See all available format strings here: |
| 228 | 228 | # http://www.djangoproject.com/documentation/templates/#now |
| 229 | | DATE_FORMAT = 'N j, Y' |
| | 229 | DATE_FORMAT = gettext_noop('N j, Y') |
| 230 | 230 | |
| 231 | 231 | # Default formatting for datetime objects. See all available format strings here: |
| 232 | 232 | # http://www.djangoproject.com/documentation/templates/#now |
| 233 | | DATETIME_FORMAT = 'N j, Y, P' |
| | 233 | DATETIME_FORMAT = gettext_noop('N j, Y, P') |
| 234 | 234 | |
| 235 | 235 | # Default formatting for time objects. See all available format strings here: |
| 236 | 236 | # http://www.djangoproject.com/documentation/templates/#now |
| 237 | | TIME_FORMAT = 'P' |
| | 237 | TIME_FORMAT = gettext_noop('P') |
| 238 | 238 | |
| 239 | 239 | # Default formatting for date objects when only the year and month are relevant. |
| 240 | 240 | # See all available format strings here: |
| 241 | 241 | # http://www.djangoproject.com/documentation/templates/#now |
| 242 | | YEAR_MONTH_FORMAT = 'F Y' |
| | 242 | YEAR_MONTH_FORMAT = gettext_noop('F Y') |
| 243 | 243 | |
| 244 | 244 | # Default formatting for date objects when only the month and day are relevant. |
| 245 | 245 | # See all available format strings here: |
| 246 | 246 | # http://www.djangoproject.com/documentation/templates/#now |
| 247 | | MONTH_DAY_FORMAT = 'F j' |
| | 247 | MONTH_DAY_FORMAT = gettext_noop('F j') |
| 248 | 248 | |
| 249 | 249 | # Do you want to manage transactions manually? |
| 250 | 250 | # Hint: you really don't! |
=== modified file 'django/contrib/admin/templatetags/admin_list.py'
|
|
|
|
| 7 | 7 | from django.utils.html import escape, conditional_escape |
| 8 | 8 | from django.utils.text import capfirst |
| 9 | 9 | from django.utils.safestring import mark_safe |
| 10 | | from django.utils.translation import get_date_formats, get_partial_date_formats, ugettext as _ |
| | 10 | from django.utils.translation import ugettext as _ |
| 11 | 11 | from django.utils.encoding import smart_unicode, smart_str, force_unicode |
| 12 | 12 | from django.template import Library |
| 13 | 13 | import datetime |
| … |
… |
|
| 161 | 161 | # Dates and times are special: They're formatted in a certain way. |
| 162 | 162 | elif isinstance(f, models.DateField) or isinstance(f, models.TimeField): |
| 163 | 163 | if field_val: |
| 164 | | (date_format, datetime_format, time_format) = get_date_formats() |
| 165 | 164 | if isinstance(f, models.DateTimeField): |
| 166 | | result_repr = capfirst(dateformat.format(field_val, datetime_format)) |
| | 165 | result_repr = capfirst(dateformat.format(field_val, _(settings.DATETIME_FORMAT))) |
| 167 | 166 | elif isinstance(f, models.TimeField): |
| 168 | | result_repr = capfirst(dateformat.time_format(field_val, time_format)) |
| | 167 | result_repr = capfirst(dateformat.time_format(field_val, _(settings.TIME_FORMAT))) |
| 169 | 168 | else: |
| 170 | | result_repr = capfirst(dateformat.format(field_val, date_format)) |
| | 169 | result_repr = capfirst(dateformat.format(field_val, _(settings.DATE_FORMAT))) |
| 171 | 170 | else: |
| 172 | 171 | result_repr = EMPTY_CHANGELIST_VALUE |
| 173 | 172 | row_class = ' class="nowrap"' |
| … |
… |
|
| 221 | 220 | year_lookup = cl.params.get(year_field) |
| 222 | 221 | month_lookup = cl.params.get(month_field) |
| 223 | 222 | day_lookup = cl.params.get(day_field) |
| 224 | | year_month_format, month_day_format = get_partial_date_formats() |
| 225 | 223 | |
| 226 | 224 | link = lambda d: mark_safe(cl.get_query_string(d, [field_generic])) |
| 227 | 225 | |
| … |
… |
|
| 231 | 229 | 'show': True, |
| 232 | 230 | 'back': { |
| 233 | 231 | 'link': link({year_field: year_lookup, month_field: month_lookup}), |
| 234 | | 'title': dateformat.format(day, year_month_format) |
| | 232 | 'title': dateformat.format(day, _(settings.YEAR_MONTH_FORMAT)) |
| 235 | 233 | }, |
| 236 | | 'choices': [{'title': dateformat.format(day, month_day_format)}] |
| | 234 | 'choices': [{'title': dateformat.format(day, _(settings.MONTH_DAY_FORMAT))}] |
| 237 | 235 | } |
| 238 | 236 | elif year_lookup and month_lookup: |
| 239 | 237 | days = cl.query_set.filter(**{year_field: year_lookup, month_field: month_lookup}).dates(field_name, 'day') |
| … |
… |
|
| 245 | 243 | }, |
| 246 | 244 | 'choices': [{ |
| 247 | 245 | 'link': link({year_field: year_lookup, month_field: month_lookup, day_field: day.day}), |
| 248 | | 'title': dateformat.format(day, month_day_format) |
| | 246 | 'title': dateformat.format(day, _(settings.MONTH_DAY_FORMAT)) |
| 249 | 247 | } for day in days] |
| 250 | 248 | } |
| 251 | 249 | elif year_lookup: |
| … |
… |
|
| 258 | 256 | }, |
| 259 | 257 | 'choices': [{ |
| 260 | 258 | 'link': link({year_field: year_lookup, month_field: month.month}), |
| 261 | | 'title': dateformat.format(month, year_month_format) |
| | 259 | 'title': dateformat.format(month, _(settings.YEAR_MONTH_FORMAT)) |
| 262 | 260 | } for month in months] |
| 263 | 261 | } |
| 264 | 262 | else: |
=== modified file 'django/contrib/databrowse/datastructures.py'
|
|
|
|
| 3 | 3 | convenience functionality and permalink functions for the databrowse app. |
| 4 | 4 | """ |
| 5 | 5 | |
| | 6 | from django.conf import settings |
| 6 | 7 | from django.db import models |
| 7 | 8 | from django.utils import dateformat |
| 8 | 9 | from django.utils.text import capfirst |
| 9 | | from django.utils.translation import get_date_formats |
| | 10 | from django.utils.translation import ugettext as _ |
| 10 | 11 | from django.utils.encoding import smart_unicode, smart_str, iri_to_uri |
| 11 | 12 | from django.utils.safestring import mark_safe |
| 12 | 13 | from django.db.models.query import QuerySet |
| … |
… |
|
| 156 | 157 | objs = dict(self.field.choices).get(self.raw_value, EMPTY_VALUE) |
| 157 | 158 | elif isinstance(self.field, models.DateField) or isinstance(self.field, models.TimeField): |
| 158 | 159 | if self.raw_value: |
| 159 | | date_format, datetime_format, time_format = get_date_formats() |
| 160 | 160 | if isinstance(self.field, models.DateTimeField): |
| 161 | | objs = capfirst(dateformat.format(self.raw_value, datetime_format)) |
| | 161 | objs = capfirst(dateformat.format(self.raw_value, _(settings.DATETIME_FORMAT))) |
| 162 | 162 | elif isinstance(self.field, models.TimeField): |
| 163 | | objs = capfirst(dateformat.time_format(self.raw_value, time_format)) |
| | 163 | objs = capfirst(dateformat.time_format(self.raw_value, _(settings.TIME_FORMAT))) |
| 164 | 164 | else: |
| 165 | | objs = capfirst(dateformat.format(self.raw_value, date_format)) |
| | 165 | objs = capfirst(dateformat.format(self.raw_value, _(settings.DATE_FORMAT))) |
| 166 | 166 | else: |
| 167 | 167 | objs = EMPTY_VALUE |
| 168 | 168 | elif isinstance(self.field, models.BooleanField) or isinstance(self.field, models.NullBooleanField): |
=== modified file 'django/contrib/databrowse/plugins/calendars.py'
|
|
|
|
| 4 | 4 | from django.contrib.databrowse.sites import DatabrowsePlugin |
| 5 | 5 | from django.shortcuts import render_to_response |
| 6 | 6 | from django.utils.text import capfirst |
| 7 | | from django.utils.translation import get_date_formats |
| 8 | 7 | from django.utils.encoding import force_unicode |
| 9 | 8 | from django.utils.safestring import mark_safe |
| 10 | 9 | from django.views.generic import date_based |
=== modified file 'django/template/defaultfilters.py'
|
|
|
|
| 620 | 620 | if not value: |
| 621 | 621 | return u'' |
| 622 | 622 | if arg is None: |
| 623 | | arg = settings.DATE_FORMAT |
| | 623 | arg = ugettext(settings.DATE_FORMAT) |
| 624 | 624 | return format(value, arg) |
| 625 | 625 | date.is_safe = False |
| 626 | 626 | |
| … |
… |
|
| 630 | 630 | if value in (None, u''): |
| 631 | 631 | return u'' |
| 632 | 632 | if arg is None: |
| 633 | | arg = settings.TIME_FORMAT |
| | 633 | arg = ugettext(settings.TIME_FORMAT) |
| 634 | 634 | return time_format(value, arg) |
| 635 | 635 | time.is_safe = False |
| 636 | 636 | |