2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 12:07:09 +00:00

synch laptop and PC

This commit is contained in:
2025-02-07 13:02:42 +00:00
parent c3eed61080
commit 7c8253dcfc

View File

@@ -39,10 +39,9 @@ def register_user(u, email, password=None, pwhash=None, fullname=""):
Do not use the lastname field, put the whole free text identification into firstname Do not use the lastname field, put the whole free text identification into firstname
as this saves hassle and works with Wookey too as this saves hassle and works with Wookey too
""" """
print(f" - {u} {fullname=}")
try: try:
if existing_user := User.objects.filter(username=u): # WALRUS if existing_user := User.objects.filter(username=u): # WALRUS
print(f" - deleting existing user '{existing_user[0]}' before importing") # print(f" - deleting existing user '{existing_user[0]}' before importing")
existing_user[0].delete() existing_user[0].delete()
user = User.objects.create_user(u, email, first_name=fullname) user = User.objects.create_user(u, email, first_name=fullname)
if pwhash: if pwhash:
@@ -62,7 +61,6 @@ def register_user(u, email, password=None, pwhash=None, fullname=""):
user.is_staff = False user.is_staff = False
user.is_superuser = False user.is_superuser = False
user.save() user.save()
print(f" - receated and reset user '{user}'")
except Exception as e: except Exception as e:
print(f"Exception <{e}>") print(f"Exception <{e}>")
print(f"{len(User.objects.all())} users now in db:\n{User.objects.all()}") print(f"{len(User.objects.all())} users now in db:\n{User.objects.all()}")