Django user.is_authenticated works in views but not templates -


i have view , logs in user:

def login_user(request): c = {} c.update(csrf(request))  username = password = '' if request.post:     username = request.post.get('username')     password = request.post.get('password')      user = authenticate(username=username, password=password)     if user not none:         if user.is_active:             login(request, user)             c.update(user(request))             return redirect('/module/')         else:             return redirect('/inactive/')     else:         return redirect('/failure/')  return render_to_response('core/auth.html',c) 

this correctly logs in user, can access django admin page if on superuser.

after logging in , being redirected display username on screen, using

          {% if user.is_authenticated %}             <p class="navbar-text pull-right">welcome, {{ user.username }}. logging in.</p>           {% else %}             <p class="navbar-text pull-right">welcome, new user. please log in.</p>           {% endif %} 

but seems believe user not logged in. appreciated.

edit: here template context processors

template_context_processors = (  "django.contrib.auth.context_processors.auth",  "django.core.context_processors.debug",  "django.core.context_processors.i18n",  "django.core.context_processors.media",  "django.core.context_processors.static",  "django.core.context_processors.tz",  "django.contrib.messages.context_processors.messages",  "django.core.context_processors.request", ) 

have tried sending requestcontext object template ?

return render_to_response('core/auth.html', c, context_instance=requestcontext(request)) 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -