#23914: Allow the {% now %} tag to store its output in the context
-------------------------------------------+---------------------------
Reporter: bmispelon | Owner: bmispelon
Type: New feature | Status: new
Component: Template system | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+---------------------------
I hit this issue when trying to use the value of the current year inside a
translated string.
Normally, you'd do something like this:
{{{
{% blocktrans %}Current year: {% now 'Y' %}{% endblocktrans %}
}}}
But this doesn't work because `blocktrans` doesn't allow other tags
inside.
So I propose adding the `as varname` syntax to `{% now %}` so you can do
something like this:
{{{
{% now 'Y' as current_year %}
{% blocktrans %}Current year: {{ current_year }}{% endblocktrans %}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23914>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.85d2c20b1eca0e63084112d9982e2862%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.