1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-07-07 21:20:14 +02:00

Add is_staff and is_active to User

This commit is contained in:
Alexandre Iooss
2019-08-02 18:37:54 +02:00
parent 8407041d26
commit 97b5469ac7
6 changed files with 90 additions and 17 deletions

View File

@ -67,6 +67,19 @@ class User(AbstractBaseUser):
pseudo = models.CharField(max_length=32, unique=True,
help_text="Doit contenir uniquement des lettres, chiffres, ou tirets. ")
comment = models.CharField(help_text="Commentaire, promo", max_length=255, blank=True)
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 should be treated as active. '
'Unselect this instead of deleting accounts.'
),
)
registered = models.DateTimeField(auto_now_add=True)
USERNAME_FIELD = 'pseudo'
@ -74,14 +87,6 @@ class User(AbstractBaseUser):
objects = UserManager()
@property
def is_active(self):
return self.state == self.STATE_ACTIVE
@property
def is_staff(self):
return self.is_admin
@property
def is_admin(self):
try: