Opened 14 years ago

Closed 14 years ago

#15267 closed (duplicate)

now template tag does not recognize predefined formats

Reported by: creecode@… Owned by: nobody
Component: Template system Version: 1.2
Severity: Keywords: now template tag predefined format
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The documentation for the now template tag < http://docs.djangoproject.com/en/dev/ref/templates/builtins/#now > says in part...

Given format can be one of the predefined ones DATE_FORMAT, DATETIME_FORMAT, SHORT_DATE_FORMAT or SHORT_DATETIME_FORMAT, or a custom format, same as the date filter.

I tried...

{% now "DATE_FORMAT" %}

...and get back...

WedAMPSTEPST0FebE_February-0800RFebAMPST

The predefined format has been processed as a custom format. I have USE_I18N and USE_L10N set to True, and
LANGUAGE_CODE is 'en-us' in settings.py. This is happening with Django 1.2.4, 1.2.5 and appears to effect trunk.

It appears from a quick glance at the source that the NowNode has no code in place to process the predefined formats.

Here is my initial query about this problem on django users < http://groups.google.com/group/django-users/browse_thread/thread/cf80ea434c1112e8/ff21567e65d8ccf6#ff21567e65d8ccf6 >.

I have attached a patch which I believe brings the code into sync with the docs.

Attachments (1)

django_now_template_tag.diff (775 bytes ) - added by creecode@… 14 years ago.

Download all attachments as: .zip

Change History (3)

by creecode@…, 14 years ago

comment:1 by creecode@…, 14 years ago

Sorry for the confusion folks. danielr already created ticket #15263 for this problem during the time (usually 24 hrs or more) I like to wait for potential responses to my initial post before proceeding. I failed to check once again after doing so yesterday to see if I could find a ticket related to this issue. danielr hadn't indicated in the user group thread that he was going to create a ticket.

comment:2 by Daniel Roseman, 14 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top