2👍
✅
Change your code to
return render_to_response('login.html', c,
context_instance=RequestContext(request))
Without the context_instance
django will not add default context processors data in the template context. So you are not getting user
object in the template.
- [Answered ]-Set name attribute in Django generated select field
- [Answered ]-Webpack: "Uncaught SyntaxError: Unexpected token <" in Django
- [Answered ]-How to get return value !=0 out of Django shell in case of error
- [Answered ]-Django + tornado | Image Upload
0👍
If you make sure that the django.contrib.auth.context_processors.auth
processor is enabled, you should just have a user
variable available in your templates.
This processor is enabled by default, but you might have disabled it if you have overwritten TEMPLATE_CONTEXT_PROCESSORS
in your settings.
- [Answered ]-Django unable to connect to database.
- [Answered ]-Leave only one active connection per user
- [Answered ]-Use a parameter attribute as a default value for another parameter?
- [Answered ]-Set the value of a django HiddenInput widget to another object's id rendered in the template
Source:stackexchange.com