Thanks..

Here is my code

from django import template
from django.template import RequestContext

register = template.Library()


@register.inclusion_tag('userinfo.html',takes_context = True)
def userinfo(context):
        request = context['request']
        address = request.session['address']
        return {'address':address}

 and request = context['request'] causing problem, seems context
doesn't have a key 'request'


And i do have

TEMPLATE_CONTEXT_PROCESSORS =(
    "django.core.context_processors.request",
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
)

in settings.py
On Feb 4, 11:17 am, Karen Tracey <[email protected]> wrote:
> On Thu, Feb 4, 2010 at 1:41 PM, weiwei <[email protected]> wrote:
> > "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
>
> >http://docs.djangoproject.com/en/dev/ref/templates/api/
>
> > But i didn't find how to activate it
>
> You activate it by including it in TEMPLATE_CONTEXT_PROCESSORS in
> settings.py.  That is all you have to do.
>
> > Here is my question
>
> >http://stackoverflow.com/questions/2160261/access-request-in-django-c...
>
> > after i followed the answer i still got errors
>
> I do not see where you show the view code in that question. Possibly you are
> not using a RequestContext to render the template?
>
> Karen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to