Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template error with Django 1.8.3 #10

Open
leodumont opened this issue Aug 13, 2015 · 1 comment
Open

Template error with Django 1.8.3 #10

leodumont opened this issue Aug 13, 2015 · 1 comment

Comments

@leodumont
Copy link

Hello,
I've quickly tried super-inlines in Django 1.8.3 and template rendering seems to raise a KeyError :

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/admin/test_nested/publications/add/

Django Version: 1.8.3
Python Version: 2.7.10
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'super_inlines',
 'django.contrib.admin',
 'corpus_brochures',
 'test_nested')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Template error:
In template /home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/super_inlines/templates/admin/edit_inline/stacked.html, error at line 56
   request

   46 :               {{ inline_admin_form.form.non_field_errors }}



   47 :             {% endif %}



   48 :             {% for fieldset in inline_admin_form %}



   49 :               {% include "admin/includes/fieldset.html" %}



   50 :             {% endfor %}



   51 :             {% if inline_admin_form.needs_explicit_pk_field %}



   52 :               {{ inline_admin_form.pk_field.field }}



   53 :             {% endif %}



   54 :             {{ inline_admin_form.fk_field.field }}



   55 : 



   56 :              {% get_sub_inline_formsets inline original forloop.counter0 forloop.last as sub_inlines %} 



   57 :             {% for sub_inline in sub_inlines %}



   58 :               {% include sub_inline.opts.template with inline_admin_formset=sub_inline is_subinline=True %}



   59 :             {% endfor %}



   60 : 



   61 :           </div>



   62 :         {% endwith %}



   63 :       {% endfor %}



   64 :     </div>



   65 : 



   66 :     {% if not is_subinline %}


Traceback:
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  164.                 response = response.render()
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/response.py" in render
  158.             self.content = self.rendered_content
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/response.py" in rendered_content
  135.         content = template.render(context, self._request)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/backends/django.py" in render
  74.         return self.template.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  209.                     return self._render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in _render
  201.         return self.nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in _render
  201.         return self.nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in _render
  201.         return self.nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  217.                             nodelist.append(node.render(context))
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  159.                 return template.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  211.                 return self._render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in _render
  201.         return self.nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  576.             return self.nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  329.                 return nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  217.                             nodelist.append(node.render(context))
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  576.             return self.nodelist.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/base.py" in render
  1227.                     context[self.target_var] = func(*resolved_args, **resolved_kwargs)
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/super_inlines/templatetags/super_inlines.py" in get_sub_inline_formsets
  16.     request = context['request']
File "/home/leo/Documents/Logiciels/anaconda/lib/python2.7/site-packages/django/template/context.py" in __getitem__
  71.         raise KeyError(key)

Exception Type: KeyError at /admin/test_nested/publications/add/
Exception Value: u'request'

Merci beaucoup de rendre disponible à la communauté votre travail quoi qu'il en soit.

@leodumont leodumont changed the title Erreur template dans Django 1.8.3 Template error with Django 1.8.3 Aug 13, 2015
@BertrandBordage
Copy link
Owner

Hello Leo,
You need to add 'django.core.context_processors.request', to the TEMPLATE_CONTEXT_PROCESSORS setting.

Something I need to specify in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants