2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 20:38:23 +00:00

slightly cleaning up slug/areacode/unofficial_number mess

This commit is contained in:
2023-09-26 01:10:50 +03:00
parent f10db6d73d
commit d4cf76da40
5 changed files with 57 additions and 41 deletions

View File

@@ -113,8 +113,9 @@ class Cave(TroggleModel):
else:
return self.unofficial_number
def reference(self): # tidy this up, no longer used?
return f"{self.areacode}-{self.number()}"
# def reference(self): # tidy this up, no longer used?
# REMOVE because of confusion with cave.references which is different
# return f"{self.areacode}-{self.number()}"
def get_absolute_url(self):
if self.kataster_number:

View File

@@ -374,7 +374,9 @@ def edit_cave(request, path="", slug=None):
cave.save()
form.save_m2m()
if slug is None:
cs = CaveSlug(cave=cave, slug=cave.reference(), primary=True)
# it is not visible on the form so it always will be None
slug = f"{cave.areacode}-{cave.number()}"
cs = CaveSlug(cave=cave, slug=slug, primary=True)
cs.save()
#ceinsts = ceFormSet.save(commit=False)
#for ceinst in ceinsts:

View File

@@ -104,7 +104,7 @@ def is_cave(wallet, id):
print(f" - Wallet {wallet} Failed to find cave object from id <{id}>")
if id.lower() != "unknown" and id != "":
print(f" - adding <{id}> to pendingcaves.txt list")
add_cave_to_pending_list(id, f"Wallet {wallet} - Could not find id <{id}>")
add_cave_to_pending_list(id, wallet, f"Wallet {wallet} - Could not find id <{id}>")
return False
def fillblankothers(w):