temporary update for model.py and view.opy
This commit is contained in:
@ -24,7 +24,6 @@ from django.db import transaction
|
||||
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
|
||||
from django.contrib.postgres.indexes import GistIndex
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth.hashers import make_password
|
||||
|
||||
from django.utils import timezone
|
||||
@ -70,7 +69,7 @@ def remove_bom_inplace(path):
|
||||
#========== Akira ここから
|
||||
class CustomUserManager(BaseUserManager):
|
||||
|
||||
def create_user(self, email, password, group, event_code, team_name, **other_fields):
|
||||
def create_user(self, email, password, group, firstname, lastname, event_code, team_name, date_of_birth, **other_fields):
|
||||
if not email:
|
||||
raise ValueError(_("You must provide an email address"))
|
||||
|
||||
@ -79,9 +78,14 @@ class CustomUserManager(BaseUserManager):
|
||||
|
||||
user = self.model(
|
||||
email=self.normalize_email(email),
|
||||
group=group,
|
||||
firstname=firstname,
|
||||
lastname=lastname,
|
||||
userid=userid,
|
||||
event_code=event_code,
|
||||
team_name=team_name,
|
||||
zekken_number=email, # 自動番号設定を考えること
|
||||
is_rogaining=True,
|
||||
date_of_birth=date_of_birth,
|
||||
)
|
||||
user.set_password(password)
|
||||
@ -89,12 +93,26 @@ class CustomUserManager(BaseUserManager):
|
||||
|
||||
return user
|
||||
|
||||
def create_superuser(self, email, password, group, event_code=None, team_name=None, **other_fields):
|
||||
def create_superuser(self, email, password, group, firstname, lastname, event_code=None, team_name=None, date_of_birth=None, **other_fields):
|
||||
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
|
||||
|
||||
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(_('Superuser must be assigned to staff'))
|
||||
if other_fields.get('is_superuser') is not True:
|
||||
raise ValueError(_('Superuser must have is_superuser set to True'))
|
||||
|
||||
user = self.create_user(
|
||||
email,
|
||||
email=self.normalize_email(email),
|
||||
group=group,
|
||||
firstname=firstname,
|
||||
lastname=lastname,
|
||||
date_of_birth=date_of_birth,
|
||||
password=password,
|
||||
)
|
||||
user.is_staff = True
|
||||
@ -206,7 +224,6 @@ class Entry(models.Model):
|
||||
#============= Akira ここまで
|
||||
|
||||
|
||||
|
||||
class JpnAdminMainPerf(models.Model):
|
||||
geom = models.MultiPolygonField(blank=True, null=True)
|
||||
adm0_en = models.CharField(max_length=254, blank=True, null=True)
|
||||
@ -225,6 +242,7 @@ class JpnAdminMainPerf(models.Model):
|
||||
]
|
||||
|
||||
|
||||
|
||||
# class JpnAdminPerf(models.Model):
|
||||
# geom = models.MultiLineStringField(blank=True, null=True)
|
||||
# et_id = models.IntegerField(blank=True, null=True)
|
||||
|
||||
Reference in New Issue
Block a user