user upload csv format changed
This commit is contained in:
@ -63,13 +63,13 @@ def remove_bom_inplace(path):
|
||||
|
||||
class CustomUserManager(BaseUserManager):
|
||||
|
||||
def create_user(self, email, password, group, **other_fields):
|
||||
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, **other_fields)
|
||||
# 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.set_password(password)
|
||||
user.save()
|
||||
|
||||
@ -810,7 +810,7 @@ def updatePolygonTable(mdl, fields):
|
||||
|
||||
def createUser(fields):
|
||||
with transaction.atomic():
|
||||
user = CustomUser.objects.create_user(email=fields[0], password=fields[1], group=fields[2])
|
||||
user = CustomUser.objects.create_user(email=fields[0], event_code=fields[1], team_name=fields[2], group=fields[3], password=fields[4])
|
||||
user.is_superuser = False
|
||||
user.is_staff = False
|
||||
user.save()
|
||||
@ -843,7 +843,9 @@ def publish_data(sender, instance, created, **kwargs):
|
||||
reader = csv.reader(txt_file, delimiter=",")
|
||||
for fields in reader:
|
||||
print("@@@@@@@@@@@@")
|
||||
print(fields[0])
|
||||
# print(fields[0])
|
||||
# print(fields[1])
|
||||
# print(fields[2])
|
||||
print("@@@@@@@@@@@@")
|
||||
createUser(fields)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user