auth.models.AbstractBaseUser.is_anonymous

is_anonymous Read-only attribute which is always False. This is a way of differentiating User and AnonymousUser objects. Generally, you should prefer using is_authenticated to this attribute. Changed in Django 1.10: In older versions, this was a method. Backwards-compatibility support for using it as a method will be removed in Django 2.0.

auth.models.AbstractBaseUser.has_usable_password()

has_usable_password() Returns False if set_unusable_password() has been called for this user.

auth.models.AbstractBaseUser.get_username()

get_username() Returns the value of the field nominated by USERNAME_FIELD.

auth.models.AbstractBaseUser.get_session_auth_hash()

get_session_auth_hash() Returns an HMAC of the password field. Used for Session invalidation on password change.

auth.models.AbstractBaseUser.clean()

clean() New in Django 1.10. Normalizes the username by calling normalize_username(). If you override this method, be sure to call super() to retain the normalization.

auth.models.AbstractBaseUser.check_password()

check_password(raw_password) Returns True if the given raw string is the correct password for the user. (This takes care of the password hashing in making the comparison.)

auth.models.AbstractBaseUser

class models.AbstractBaseUser get_username() Returns the value of the field nominated by USERNAME_FIELD. clean() New in Django 1.10. Normalizes the username by calling normalize_username(). If you override this method, be sure to call super() to retain the normalization. classmethod normalize_username(username) New in Django 1.10. Applies NFKC Unicode normalization to usernames so that visually identical characters with different Unicode code points are considered identica

auth.mixins.UserPassesTestMixin.test_func()

test_func() You have to override the test_func() method of the class to provide the test that is performed. Furthermore, you can set any of the parameters of AccessMixin to customize the handling of unauthorized users: from django.contrib.auth.mixins import UserPassesTestMixin class MyView(UserPassesTestMixin, View): def test_func(self): return self.request.user.email.endswith('@example.com')

auth.mixins.UserPassesTestMixin.get_test_func()

get_test_func() You can also override the get_test_func() method to have the mixin use a differently named function for its checks (instead of test_func()). Stacking UserPassesTestMixin Due to the way UserPassesTestMixin is implemented, you cannot stack them in your inheritance list. The following does NOT work: class TestMixin1(UserPassesTestMixin): def test_func(self): return self.request.user.email.endswith('@example.com') class TestMixin2(UserPassesTestMixin): def test_

auth.mixins.UserPassesTestMixin

class UserPassesTestMixin New in Django 1.9. When using class-based views, you can use the UserPassesTestMixin to do this. test_func() You have to override the test_func() method of the class to provide the test that is performed. Furthermore, you can set any of the parameters of AccessMixin to customize the handling of unauthorized users: from django.contrib.auth.mixins import UserPassesTestMixin class MyView(UserPassesTestMixin, View): def test_func(self): return self.re