2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 19:27:11 +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
as this saves hassle and works with Wookey too
"""
print(f" - {u} {fullname=}")
try:
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()
user = User.objects.create_user(u, email, first_name=fullname)
if pwhash:
@@ -62,7 +61,6 @@ def register_user(u, email, password=None, pwhash=None, fullname=""):
user.is_staff = False
user.is_superuser = False
user.save()
print(f" - receated and reset user '{user}'")
except Exception as e:
print(f"Exception <{e}>")
print(f"{len(User.objects.all())} users now in db:\n{User.objects.all()}")