2👍
✅
Use is_authenticated()
method
Like this: if request.user.is_authenticated():
You can find the reference here: https://docs.djangoproject.com/en/dev/ref/contrib/auth/#methods
Source:stackexchange.com