11👍
In older versions of Django request.user.is_authenticated was a method. It’s now an attribute and no longer requires parenthesis. If you change your code to:
if request.user.is_authenticated:
It should be work as expected.
For more info see the docs here: https://docs.djangoproject.com/en/1.11/ref/contrib/auth/#django.contrib.auth.models.User.is_authenticated
-2👍
you forget to import csrf module please try to add this line and make sure to avoid hardcoded urls try to use url names
from django.core.context_processors import csrf
- [Django]-How can I set arbitrary attributes on Django Model Fields, then access them in a ModelForm?
- [Django]-Django: "Forbidden (403) CSRF verification failed. Request aborted." in Docker Production
- [Django]-How to set a login cookie in django?
- [Django]-Django Internationalization—compilemessages error:AttributeError: module 'locale' has no attribute 'normalize'
- [Django]-Django – WSGI script cannot be loaded as Python module
Source:stackexchange.com