Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to activate DJANGO.CORE.CONTEXT_PROCESSORS.REQUEST
    primarykey
    data
    text
    <p>I read this</p> <p>"DJANGO.CORE.CONTEXT_PROCESSORS.REQUEST If TEMPLATE_CONTEXT_PROCESSORS contains this processor, every RequestContext will contain a variable request, which is the current HttpRequest. Note that this processor is not enabled by default; you'll have to activate it. " from this page</p> <p><a href="http://docs.djangoproject.com/en/dev/ref/templates/api/" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/ref/templates/api/</a></p> <p>But it seems there is no information how to activate this processor.</p> <p>Here is my original question </p> <p><a href="https://stackoverflow.com/questions/2160261/access-request-in-django-custom-template-tags">Access request in django custom template tags</a></p> <p>After i followed the answer</p> <p>i still got errors</p> <pre><code>TemplateSyntaxError at / Caught an exception while rendering: 'request' Original Traceback (most recent call last): File "C:\Python25\lib\site-packages\django\template\debug.py", line 71, in render_node result = node.render(context) File "C:\Python25\lib\site-packages\django\template__init__.py", line 936, in render dict = func(*args) File "c:\...\myapp_extras.py", line 7, in login request = context['request'] File "C:\Python25\lib\site-packages\django\template\context.py", line 44, in getitem raise KeyError(key) KeyError: 'request' </code></pre> <p>the code causing problem is </p> <p><strong>request = context['request']</strong> in </p> <pre><code>from django import template register = template.Library() @register.inclusion_tag('userinfo.html',takes_context = True) def userinfo(context): request = context['request'] address = request.session['address'] return {'address':address} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload