I use django-registration and just set it up.
{{user.is_authenticated }}
true, although I already went to / accounts / logout / and registered the user.
{{user.is_anonymous }}
also returns true. According to django docs, the two should be different:
is_anonymous: always returns False. This is a way to differentiate User and AnonymousUser objects. Generally, you should use the is_authenticated () method for this method.
and
is_authenticated: always returns True. This is a way to find out if a user has authenticated. This does not imply any permissions and does not check if the user is active - it only indicates that the user has provided a valid username and password.
, django . tempalate :
{% if user.is_authenticated %}
{% user }}
{% if user.is_anonymous %}
is anonymous
{% endif $}
{% else %}
gotta login
{% endif %}
? !
UPDATE:
, is_authenticated, id_anonymous True, /accounts/login , is_anonymous true, . , , :
def home(request):
return render_jinja(request, 'index.html', blah = 'ga')
2:
print (request.user.is_authenticated()) False. :
return render_jinja(request, 'index.html', blah = 'ga')
user.is_authenticated FALSE.
3:
render_to_response, render_jinja, . , : (