mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
Merge branch 'fix_users_models_shenanigans' into 'dev'
Fix users/models.py shenanigans See merge request re2o/re2o!600
This commit is contained in:
commit
e549d005dd
1 changed files with 6 additions and 4 deletions
|
@ -92,8 +92,10 @@ from PIL import Image
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
# General utilities
|
# General utilities
|
||||||
|
|
||||||
|
|
||||||
def linux_user_check(login):
|
def linux_user_check(login):
|
||||||
"""Check if a login comply with unix base login policy
|
"""Check if a login comply with unix base login policy
|
||||||
|
|
||||||
|
@ -913,8 +915,8 @@ class User(
|
||||||
days_not_zero = self.facture_set.filter(valid=True).exclude(Q(vente__duration_days_membership=0)).exists()
|
days_not_zero = self.facture_set.filter(valid=True).exclude(Q(vente__duration_days_membership=0)).exists()
|
||||||
if(not_zero or days_not_zero\
|
if(not_zero or days_not_zero\
|
||||||
or OptionalUser.get_cached_value("all_users_active")):
|
or OptionalUser.get_cached_value("all_users_active")):
|
||||||
self.state = self.STATE_ACTIVE
|
self.state = self.STATE_ACTIVE
|
||||||
self.save()
|
self.save()
|
||||||
if self.state == self.STATE_ARCHIVE or self.state == self.STATE_FULL_ARCHIVE:
|
if self.state == self.STATE_ARCHIVE or self.state == self.STATE_FULL_ARCHIVE:
|
||||||
self.unarchive()
|
self.unarchive()
|
||||||
self.state = self.STATE_ACTIVE
|
self.state = self.STATE_ACTIVE
|
||||||
|
@ -1862,6 +1864,7 @@ class User(
|
||||||
"""
|
"""
|
||||||
return self.theme.split(".")[0]
|
return self.theme.split(".")[0]
|
||||||
|
|
||||||
|
|
||||||
class Adherent(User):
|
class Adherent(User):
|
||||||
"""Base re2o Adherent model, inherit from User. Add other attributes.
|
"""Base re2o Adherent model, inherit from User. Add other attributes.
|
||||||
|
|
||||||
|
@ -1923,7 +1926,7 @@ class Adherent(User):
|
||||||
:return: An adherent.
|
:return: An adherent.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return cls.objects.get(pk=adherentid)
|
return cls.objects.get(pk=object_id)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def can_create(user_request, *_args, **_kwargs):
|
def can_create(user_request, *_args, **_kwargs):
|
||||||
|
@ -2790,4 +2793,3 @@ class EMailAddress(RevMixin, AclMixin, models.Model):
|
||||||
if result:
|
if result:
|
||||||
raise ValidationError(reason)
|
raise ValidationError(reason)
|
||||||
super(EMailAddress, self).clean(*args, **kwargs)
|
super(EMailAddress, self).clean(*args, **kwargs)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue