diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2016-04-02 13:18:26 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-04-09 14:54:18 -0400 |
| commit | c1aec0feda73ede09503192a66f973598aef901d (patch) | |
| tree | f1e4c09f3e98177cfe78cc9039b300f8984e7aed /django/contrib/auth/base_user.py | |
| parent | c16b9dd8e0ae757616e9accbaffecc521191ee98 (diff) | |
Fixed #25847 -- Made User.is_(anonymous|authenticated) properties.
Diffstat (limited to 'django/contrib/auth/base_user.py')
| -rw-r--r-- | django/contrib/auth/base_user.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/django/contrib/auth/base_user.py b/django/contrib/auth/base_user.py index 48ab950c43..c8f748cf02 100644 --- a/django/contrib/auth/base_user.py +++ b/django/contrib/auth/base_user.py @@ -10,6 +10,7 @@ from django.contrib.auth.hashers import ( ) from django.db import models from django.utils.crypto import get_random_string, salted_hmac +from django.utils.deprecation import CallableFalse, CallableTrue from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ @@ -79,19 +80,21 @@ class AbstractBaseUser(models.Model): def natural_key(self): return (self.get_username(),) + @property def is_anonymous(self): """ Always return False. This is a way of comparing User objects to anonymous users. """ - return False + return CallableFalse + @property def is_authenticated(self): """ Always return True. This is a way to tell if the user has been authenticated in templates. """ - return True + return CallableTrue def set_password(self, raw_password): self.password = make_password(raw_password) |
