Django context processor gets AnonymousUser
- by myfreeweb
instead of User.
def myview(request):
return render_to_response('tmpl.html', {'user': User.objects.get(id=1})
works fine and passes User to template.
But
def myview(request):
return render_to_response('tmpl.html', {}, context_instance=RequestContext(request))
with a context processor
def user(request):
from django.contrib.auth.models import User
return {'user': User.objects.get(id=1)}
passes AnonymousUser, so I can't get the variables I need :(
What's wrong?