user upload csv format changed

This commit is contained in:
Mohamed Nouffer
2023-05-15 16:32:01 +05:30
parent e71d2e6f04
commit 0023692a4c
2 changed files with 7 additions and 5 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -63,13 +63,13 @@ def remove_bom_inplace(path):
class CustomUserManager(BaseUserManager): 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: if not email:
raise ValueError(_("You must provide an email address")) raise ValueError(_("You must provide an email address"))
email = self.normalize_email(email) # email = self.normalize_email(email)
user=self.model(email=email, group=group, **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.set_password(password)
user.save() user.save()
@ -810,7 +810,7 @@ def updatePolygonTable(mdl, fields):
def createUser(fields): def createUser(fields):
with transaction.atomic(): 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_superuser = False
user.is_staff = False user.is_staff = False
user.save() user.save()
@ -843,7 +843,9 @@ def publish_data(sender, instance, created, **kwargs):
reader = csv.reader(txt_file, delimiter=",") reader = csv.reader(txt_file, delimiter=",")
for fields in reader: for fields in reader:
print("@@@@@@@@@@@@") print("@@@@@@@@@@@@")
print(fields[0]) # print(fields[0])
# print(fields[1])
# print(fields[2])
print("@@@@@@@@@@@@") print("@@@@@@@@@@@@")
createUser(fields) createUser(fields)