2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

trying to enable eidting of blank letter for entrance

This commit is contained in:
Philip Sargent 2023-08-04 09:08:18 +03:00
parent e101f4ed2f
commit bed663a031
2 changed files with 13 additions and 4 deletions

View File

@ -442,13 +442,19 @@ def edit_entrance(request, path="", caveslug=None, entslug=None):
entrance = None
if entslug:
print(f"{caveslug=} {entslug=} {path=}")
print(f"{caveslug=} {entslug=} {path=} number of ents:{cave.entrances().count()}")
caveAndEntrance = CaveAndEntrance.objects.get(entrance=entrance, cave=cave)
entlettereditable = False
else:
caveAndEntrance = CaveAndEntrance(cave=cave, entrance=Entrance())
entlettereditable = True
if caveAndEntrance.entranceletter == "" and cave.entrances().count() > 0 :
# this should not be blank on a multiple-entrance cave
entlettereditable = True
print(f"{entlettereditable=}")
if request.POST:
print(f"Online edit of entrance {entrance.slug}")
form = EntranceForm(request.POST, instance=entrance)

View File

@ -1,5 +1,6 @@
import os
import re
import string
from pathlib import Path
@ -511,7 +512,9 @@ def read_cave(filename, cave=None):
if len(entrances) > 1 and letter =="":
# user error, but we can recover
letter = eslug[-1].lower()
message = f"- Warning - duplicate entrance or empty 'letter' field for '{eslug}' in cave '{cave}', setting to {letter}."
if letter.lower() not in list(string.ascii_lowercase):
letter = "x"
message = f"- Warning - Empty 'letter' field for '{eslug}' in multiple-entrance cave '{cave}', setting to {letter}."
DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.area}/{cave.area}-{cave.url}_cave_edit/")
print(message)