2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +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 entrance = None
if entslug: 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) caveAndEntrance = CaveAndEntrance.objects.get(entrance=entrance, cave=cave)
entlettereditable = False entlettereditable = False
else: else:
caveAndEntrance = CaveAndEntrance(cave=cave, entrance=Entrance()) caveAndEntrance = CaveAndEntrance(cave=cave, entrance=Entrance())
entlettereditable = True 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: if request.POST:
print(f"Online edit of entrance {entrance.slug}") print(f"Online edit of entrance {entrance.slug}")
form = EntranceForm(request.POST, instance=entrance) form = EntranceForm(request.POST, instance=entrance)

View File

@ -1,5 +1,6 @@
import os import os
import re import re
import string
from pathlib import Path from pathlib import Path
@ -511,7 +512,9 @@ def read_cave(filename, cave=None):
if len(entrances) > 1 and letter =="": if len(entrances) > 1 and letter =="":
# user error, but we can recover # user error, but we can recover
letter = eslug[-1].lower() 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/") DataIssue.objects.create(parser="entrances", message=message, url=f"{cave.area}/{cave.area}-{cave.url}_cave_edit/")
print(message) print(message)