Permalink
Browse files

Add more methods required by django API

  • Loading branch information...
william-gr committed Nov 1, 2013
1 parent cb4072e commit a736541f996adf885bfe924de17d3d2cee2ccd2f
Showing with 27 additions and 0 deletions.
  1. +27 −0 gui/account/models.py
View
@@ -130,6 +130,9 @@ class bsdUsers(Model):
default=False,
)
+ is_active = True
+ is_staff = True
+
class Meta:
verbose_name = _("User")
verbose_name_plural = _("Users")
@@ -140,6 +143,30 @@ def __unicode__(self):
def is_authenticated(self):
return True
+ def get_username(self):
+ "Return the identifying username for this User"
+ return getattr(self, self.USERNAME_FIELD)
+
+ def __str__(self):
+ return self.get_username()
+
+ def natural_key(self):
+ return (self.get_username(),)
+
+ 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.
+ """
+ return True
+
def delete(self, using=None, reload=True):
if self.bsdusr_builtin == True:
raise ValueError(_("User %s is built-in and can not be "

0 comments on commit a736541

Please sign in to comment.