Reputation: 58933
I have this in my setting.py
:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
'django.core.context_processors.static',
'django.contrib.auth.context_processors.auth',
)
Whenever I try to access the request in a template (for example {{ request.user.get_profile.custom_username }}
) I get no result. I think the request is not added to the template, because if i force the request in to the Context (in the view), I can access it:
ctx = {}
#ctx['request'] = request
return render_to_response('index.html', ctx)
Any help? Thanks
Upvotes: 1
Views: 980
Reputation: 7041
Use the render shortcut instead, easier to remember:
return render(request, 'index.html', ctx)
Upvotes: 7