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

Rename lookupAttribs and nonLookupAttribs + add slug to Person

This commit is contained in:
2023-10-01 12:42:47 +03:00
parent fd94909ee7
commit 16d3ee9f92
7 changed files with 42 additions and 39 deletions

View File

@@ -78,15 +78,16 @@ def load_people_expos():
if nexpos <= 0:
print(" - Creating expeditions")
for year in years:
lookupAttribs = {"year": year}
nonLookupAttribs = {"name": f"CUCC expo {year}"}
e = Expedition.objects.create(**nonLookupAttribs, **lookupAttribs)
coUniqueAttribs = {"year": year}
otherAttribs = {"name": f"CUCC expo {year}"}
e = Expedition.objects.create(**otherAttribs, **coUniqueAttribs)
print(" - Loading personexpeditions")
for personline in personreader:
name = personline[header["Name"]]
name = re.sub(r"<.*?>", "", name)
slug = slugify(name)
firstname = ""
nick = ""
@@ -111,9 +112,9 @@ def load_people_expos():
else:
vfho = True
lookupAttribs = {"first_name": firstname, "last_name": (lastname or "")}
nonLookupAttribs = {"is_vfho": vfho, "fullname": fullname, "nickname": nick}
person = Person.objects.create(**nonLookupAttribs, **lookupAttribs)
coUniqueAttribs = {"first_name": firstname, "last_name": (lastname or "")}
otherAttribs = {"is_vfho": vfho, "fullname": fullname, "nickname": nick}
person = Person.objects.create(**otherAttribs, **coUniqueAttribs)
parse_blurb(personline=personline, header=header, person=person)
@@ -121,9 +122,9 @@ def load_people_expos():
for year, attended in list(zip(headers, personline))[5:]:
expedition = Expedition.objects.get(year=year)
if attended == "1" or attended == "-1":
lookupAttribs = {"person": person, "expedition": expedition}
nonLookupAttribs = {"is_guest": (personline[header["Guest"]] == "1")}
pe = PersonExpedition.objects.create(**nonLookupAttribs, **lookupAttribs)
coUniqueAttribs = {"person": person, "expedition": expedition}
otherAttribs = {"is_guest": (personline[header["Guest"]] == "1")}
pe = PersonExpedition.objects.create(**otherAttribs, **coUniqueAttribs)
print("", flush=True)