#24538: Rendering a Jinja template with a context containing 'self' fails
---------------------------------+-------------------------------------
Reporter: tim_heap | Owner: charettes
Type: Bug | Status: closed
Component: Template system | Version: 1.8rc1
Severity: Release blocker | Resolution: invalid
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------
Comment (by tim_heap):
Upon further reading, it appears that 'self' is a special variable in
Jinja. [http://jinja.pocoo.org/docs/dev/templates/#child-template From the
Jinja docs]:
If you want to print a block multiple times, you can, however, use the
special self variable and call the block with that name:
{{{#!jinja
<title>{% block title %}{% endblock %}</title>
<h1>{{ self.title() }}</h1>
{% block body %}{% endblock %}
}}}
Changing Jinja to suit this requirement is not reasonable, so I will log a
bug with Wagtail CMS to rename the 'self' variable to something that can
work.
--
Ticket URL: <https://code.djangoproject.com/ticket/24538#comment:4>
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/066.ee9d3a2344b0dbb99a8bf80e56b3cc86%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.