mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 04:19:25 +00:00
Add groups, allow to ban users from counters and from buying alcohol
This commit is contained in:
@ -169,13 +169,6 @@ class User(AbstractBaseUser):
|
||||
parent_address = models.CharField(_("parent address"), max_length=128, blank=True, default="")
|
||||
is_subscriber_viewable = models.BooleanField(_("is subscriber viewable"), default=True)
|
||||
godfathers = models.ManyToManyField('User', related_name='godchildren', blank=True)
|
||||
is_banned_alcohol = models.BooleanField(
|
||||
_('banned from buying alcohol'),
|
||||
default=False,
|
||||
help_text=_(
|
||||
'Designates whether this user is denyed from buying alchool. '
|
||||
),
|
||||
)
|
||||
|
||||
objects = UserManager()
|
||||
|
||||
@ -248,6 +241,14 @@ class User(AbstractBaseUser):
|
||||
from club.models import Club
|
||||
return Club.objects.filter(unix_name=settings.SITH_LAUNDERETTE_MANAGER['unix_name']).first().get_membership_for(self)
|
||||
|
||||
@property
|
||||
def is_banned_alcohol(self):
|
||||
return self.groups.filter(name=settings.SITH_GROUPS['banned-alcohol']['name']).exists()
|
||||
|
||||
@property
|
||||
def is_banned_counter(self):
|
||||
return self.groups.filter(name=settings.SITH_GROUPS['banned-from-counters']['name']).exists()
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
create = False
|
||||
with transaction.atomic():
|
||||
|
Reference in New Issue
Block a user