I’m using User authentication to all pages. Like this:
@login_required(redirect_field_name='redirect_to')
def memp(request):
...
But some pages can not get user information.
In views: request.GET.get('user') = None and in templates: {{user}} = None
I cannot find the root cause of it.
In a view you should be using
request.user, does that work?In a template, if
{{ user }}doesn’t work, make sure you are using aRequestContextto render the template. You should also make sure you have the"django.contrib.auth.context_processors.auth"context processor active in yoursettings.py.