#24538: Rendering a Jinja template with a context containing 'self' fails
---------------------------------+--------------------
     Reporter:  tim_heap         |      Owner:  nobody
         Type:  Uncategorized    |     Status:  new
    Component:  Template system  |    Version:  1.8rc1
     Severity:  Normal           |   Keywords:
 Triage Stage:  Unreviewed       |  Has patch:  0
Easy pickings:  0                |      UI/UX:  0
---------------------------------+--------------------
 Rendering a DTL template with a context containing a 'self' key works.
 Attempting the same with a Jinja template fails:

 {{{
 from django.shortcuts import render


 def self_test(request):
     # Assuming that there exists a DTL style template 'dtl.html',
     # and a Jinja template named 'jinja.html':
     render(request, 'dtl.html', {'self': 'test'})  # Works
     render(request, 'jinja.html', {'self': 'test'})   # Fails
 }}}

 {{{
 Internal Server Error: /self_test/
 Traceback (most recent call last):
   File "/home/vagrant/jinjatest_venv/local/lib/python2.7/site-
 packages/django/core/handlers/base.py", line 132, in get_response
     response = wrapped_callback(request, *callback_args,
 **callback_kwargs)
   File "/vagrant/jinjatest/views.py", line 6, in self_test
     render(request, 'jinja.html', {'self': 'test'})
   File "/home/vagrant/jinjatest_venv/local/lib/python2.7/site-
 packages/django/shortcuts.py", line 67, in render
     template_name, context, request=request, using=using)
   File "/home/vagrant/jinjatest_venv/local/lib/python2.7/site-
 packages/django/template/loader.py", line 99, in render_to_string
     return template.render(context, request)
   File "/home/vagrant/jinjatest_venv/local/lib/python2.7/site-
 packages/django/template/backends/jinja2.py", line 63, in render
     return self.template.render(**context)
 TypeError: render() got multiple values for keyword argument 'self'
 }}}

 The Wagtail CMS uses 'self' as a key when rendering pages. This error
 means that Wagtail can not be used in combination with Jinja templates.

 The contents of the templates is irrelevant, and can be blank for testing.

--
Ticket URL: <https://code.djangoproject.com/ticket/24538>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.a129341a9d5630974e8fe044c5315a0b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to