Reputation: 1609
I wish to access the currently logged in user while overriding the change_form.html
for a django model in my project. I want to access the request.user.username
in this form. How do I access this. I do not want to write a custom view for the same. In this template I wish to access it as {{ request.user.username }}
. How do I do it? I am using Django version 1.6.5.
Upvotes: 1
Views: 745
Reputation: 2291
You should add request to context:
TEMPLATE_CONTEXT_PROCESSORS = (
...
'django.core.context_processors.request',
)
Upvotes: 1