I noticed when we login in Django we are no longer AnonymousUser (in models.py) but rather become AbstractBaseUser (in models.py).
How does django handle this change ?
Basically it is inside the AuthenticationMiddleware
of django/contrib/auth/middleware.py: request.user = SimpleLazyObject(lambda: get_user(request))
which calls the get_user
from the same module:
and finally get_user
from django/contrib/auth/__init__.py which returns return user or AnonymousUser()
.
Most probably you are interested in the last one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With