1👍
You can access to the user
object even if you don’t pass it implicitly in the view response.
By default it is an anonymous user
, until an user log in and authenticates itself
0👍
You probably have the auth context processor and/or middleware set which adds the user variable to context
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
)
MIDDLEWARE_CLASSES = (
"django.contrib.auth.middleware.AuthenticationMiddleware",
)
- [Answer]-Override __init__ method to format initial value on modelform
- [Answer]-Append choices to choice list in Django models dynamically
- [Answer]-Csrf token issue with multiple templates
Source:stackexchange.com