Template variable in filter?

1 view
Skip to first unread message

Mike Chambers

unread,
Apr 29, 2008, 2:25:42 AM4/29/08
to django...@googlegroups.com
Is it possible to include a template variable inside a filter?

Specifically, I want to have a global setting for the date format string:

Something like:

settings.py
--
DATE_TIME_FORMAT = "M j, F \a\t P"


template
--
{{ comment.date_submitted|date:{{DATE_TIME_FORMAT}}}}

I am guessing that I could write a custom filter that handles this, was
curious if there was another way to do it.

mike

Message has been deleted

pk

unread,
May 3, 2008, 9:16:44 AM5/3/08
to Django users
Isn't this already in settings.py?
Look at the code for the filters
/django/template/defaultfilters.py
it reads DATE_FORMAT and TIME_FORMAT from the settings file.

P.K.
Reply all
Reply to author
Forward
0 new messages