51👍
Shouldn’t it be request.user.is_authenticated()
i.e. with brackets as it’s a function?
For Django 1.10 +
is_authenticated
is now an attribute (although it is being kept backwards compatible for now).
12👍
As Richard mentioned is_authenticated is a function, so in your view it should be called like: request.user.is_authenticated()
.
Because of django templating language there can be confusion, because calling this in a template makes it appear as a property and not a method.
{{ user.is_authenticated}}
https://docs.djangoproject.com/en/dev/topics/auth/
- Django-rest-swagger nested serializers with readonly fields not rendered properly
- Registering Django system checks in AppConfig's ready() method
- Django QuerySet Custom Ordering by ID
4👍
its changed again from Pull request #216.
now your problem is fixed, if you are using Django 2.0+, look at this GitHub issue is the same issues you had. so in Django 2.0+
request.user.is_authenticated
is true!
2👍
I’ve django 2.0, I tried this and works
if request.user.is_authenticated:
- How to show more than 100 items on each paginated "Change List" page in Django Admin?
- Django – show loading message during long processing