Ticket #2062: partial_date_formats.diff
| File partial_date_formats.diff, 2.1 kB (added by ramiro, 2 years ago) |
|---|
-
dj-date-formats/django/conf/global_settings.py
old new 203 203 # http://www.djangoproject.com/documentation/templates/#now 204 204 TIME_FORMAT = 'P' 205 205 206 # Default formatting for time objects when only the year and month are relevant. 207 # See all available format strings here: 208 # http://www.djangoproject.com/documentation/templates/#now 209 YEAR_MONTH_FORMAT = 'F Y' 210 211 # Default formatting for time objects when only the month and day are relevant. 212 # See all available format strings here: 213 # http://www.djangoproject.com/documentation/templates/#now 214 MONTH_DAY_FORMAT = 'F j' 215 206 216 # Whether to enable Psyco, which optimizes Python code. Requires Psyco. 207 217 # http://psyco.sourceforge.net/ 208 218 ENABLE_PSYCO = False -
dj-date-formats/django/utils/translation.py
old new 371 371 time_format = settings.TIME_FORMAT 372 372 return (date_format, datetime_format, time_format) 373 373 374 def get_partial_date_formats(): 375 """ 376 This function checks whether translation files provide a translation for some 377 technical message ID to store partial date formats. If it doesn't contain 378 one, the formats provided in the settings will be used. 379 """ 380 from django.conf import settings 381 year_month_format = _('YEAR_MONTH_FORMAT') 382 month_day_format = _('MONTH_DAY_FORMAT') 383 if year_month_format == 'YEAR_MONTH_FORMAT': 384 year_month_format = settings.YEAR_MONTH_FORMAT 385 if month_day_format == 'MONTH_DAY_FORMAT': 386 month_day_format = settings.MONTH_DAY_FORMAT 387 return (year_month_format, month_day_format) 388 374 389 def install(): 375 390 """ 376 391 Installs the gettext function as the default translation function under
