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

fixing cave_edit

This commit is contained in:
2024-06-28 18:31:23 +03:00
parent 5fff060487
commit 03fa36576b
2 changed files with 24 additions and 9 deletions

View File

@@ -405,7 +405,10 @@ def edit_cave(request, path="", slug=None):
Warning. This uses Django deep magic in the CaveForm processing.
It saves the data into into the database and into the html file, which it then commits to git.
We basically ignore the <path> as the <slug> is of the format 1624-114 and contains the area code
"""
#print(f"edit_cave(): {path=} {slug=}")
message = ""
if slug is not None:
try:
@@ -454,8 +457,14 @@ def edit_cave(request, path="", slug=None):
else:
if slug is not None:
# re-read cave data from file.
#print(f"edit_cave(): {cave=} {cave.filename=}")
#print(f"edit_cave(): {cave.slug()=}")
if cave.filename:
read_cave(cave.filename, cave=cave)
try:
read_cave(cave.filename, cave=cave)
except Exception as e:
print(f"edit_cave(): EXCEPTION attempting to read_cave()\n{e}")
raise
form = CaveForm(instance=cave, initial={'cave_slug': cave.slug()})
#ceFormSet = CaveAndEntranceFormSet(queryset=cave.caveandentrance_set.all())