disable docker pg

This commit is contained in:
2024-01-26 11:43:29 +05:30
parent bfe5a9440c
commit acd34b86b8
5 changed files with 60 additions and 46 deletions

View File

@ -65,29 +65,32 @@ def remove_bom_inplace(path):
class CustomUserManager(BaseUserManager):
def create_user(self, email, password, group, event_code, team_name, **other_fields):
if not email:
raise ValueError(_("You must provide an email address"))
# email = self.normalize_email(email)
user=self.model(email=email, group=group, event_code=event_code, team_name=team_name, zekken_number=email, is_rogaining=True, **other_fields)
user = self.model(email=email, group=group, event_code=event_code, team_name=team_name, zekken_number=email, is_rogaining=True, **other_fields)
user.set_password(password)
user.save()
return user
def create_superuser(self, email, password, group, event_code=None, team_name=None, **other_fields):
# Providing default values for event_code and team_name if they are not provided
if event_code is None:
event_code = 'test' # replace this with some default value
if team_name is None:
team_name = 'test' # replace this with some default value
def create_superuser(self, email, password, group, **other_fields):
other_fields.setdefault('is_staff', True)
other_fields.setdefault('is_superuser', True)
other_fields.setdefault('is_active', True)
if other_fields.get('is_staff') is not True:
raise ValueError(_('Supperuser must assigned to staff'))
raise ValueError(_('Superuser must be assigned to staff'))
if other_fields.get('is_superuser') is not True:
raise ValueError(_('Supperuser must assigned to superuser=True'))
raise ValueError(_('Superuser must have is_superuser set to True'))
return self.create_user(email, password, group, **other_fields)
return self.create_user(email, password, group, event_code, team_name, **other_fields)