templates - Use 'now' in django blocktrans? -
i'd add year django blocktrans - using syntax below.
{% blocktrans now|date:"y" copydate %} © {{ copydate }} company {% endblocktrans %}
this similar existing django ticket (http://code.djangoproject.com/ticket/3088), apparently should work can't work either.
in both cases tag not expanded, rest of blocktrans renders fine.
the way date in python , use date filter reiner proposes or define own templatetag. can create little context processors set date in context.
def my_date(request): import datetime return {'my_date':datetime.datetime.now()}
and add in settings.py
template_context_processors = default_settings.template_context_processors + ( 'the_package_of_my_tiny_function.my_date', )
use in templates this:
{% blocktrans my_date|date:"y" copydate %} © {{ copydate }} company {% endblocktrans %}
don't forget pass requestcontext context_instance in views
here example.
Comments
Post a Comment