diff options
| author | Robin Munn <robin.munn@gmail.com> | 2006-11-08 04:50:01 +0000 |
|---|---|---|
| committer | Robin Munn <robin.munn@gmail.com> | 2006-11-08 04:50:01 +0000 |
| commit | dadfca08c0db567ce33284aaa8eb388cf667a836 (patch) | |
| tree | ab7255eeee1bbe03d95652cc74a3843fa052d8ac /django/contrib/auth | |
| parent | 0b059aa4eadc1d95ceca3a32821b65a9fb2a53e8 (diff) | |
sqlalchemy: Merged revisions 3918 to 4053 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/sqlalchemy@4054 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/auth')
| -rw-r--r-- | django/contrib/auth/__init__.py | 2 | ||||
| -rw-r--r-- | django/contrib/auth/models.py | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/django/contrib/auth/__init__.py b/django/contrib/auth/__init__.py index a0097a01ed..dd3b8152e6 100644 --- a/django/contrib/auth/__init__.py +++ b/django/contrib/auth/__init__.py @@ -9,7 +9,7 @@ def load_backend(path): i = path.rfind('.') module, attr = path[:i], path[i+1:] try: - mod = __import__(module, '', '', [attr]) + mod = __import__(module, {}, {}, [attr]) except ImportError, e: raise ImproperlyConfigured, 'Error importing authentication backend %s: "%s"' % (module, e) try: diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index 73bcfe92aa..58cc07efa9 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -92,9 +92,9 @@ class User(models.Model): last_name = models.CharField(_('last name'), maxlength=30, blank=True) email = models.EmailField(_('e-mail address'), blank=True) password = models.CharField(_('password'), maxlength=128, help_text=_("Use '[algo]$[salt]$[hexdigest]'")) - is_staff = models.BooleanField(_('staff status'), help_text=_("Designates whether the user can log into this admin site.")) + is_staff = models.BooleanField(_('staff status'), default=False, help_text=_("Designates whether the user can log into this admin site.")) is_active = models.BooleanField(_('active'), default=True, help_text=_("Designates whether this user can log into the Django admin. Unselect this instead of deleting accounts.")) - is_superuser = models.BooleanField(_('superuser status'), help_text=_("Designates that this user has all permissions without explicitly assigning them.")) + is_superuser = models.BooleanField(_('superuser status'), default=False, help_text=_("Designates that this user has all permissions without explicitly assigning them.")) last_login = models.DateTimeField(_('last login'), default=models.LazyDate()) date_joined = models.DateTimeField(_('date joined'), default=models.LazyDate()) groups = models.ManyToManyField(Group, verbose_name=_('groups'), blank=True, @@ -126,7 +126,7 @@ class User(models.Model): def is_anonymous(self): "Always returns False. This is a way of comparing User objects to anonymous users." return False - + def is_authenticated(self): """Always return True. This is a way to tell if the user has been authenticated in templates. """ @@ -270,6 +270,15 @@ class AnonymousUser(object): def __str__(self): return 'AnonymousUser' + def __eq__(self, other): + return isinstance(other, self.__class__) + + def __ne__(self, other): + return not self.__eq__(other) + + def __hash__(self): + return 1 # instances always return the same hash value + def save(self): raise NotImplementedError @@ -301,6 +310,6 @@ class AnonymousUser(object): def is_anonymous(self): return True - + def is_authenticated(self): return False |
