summaryrefslogtreecommitdiffstats
path: root/core/views/caves.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views/caves.py')
-rw-r--r--core/views/caves.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/views/caves.py b/core/views/caves.py
index 70a7a84..890782f 100644
--- a/core/views/caves.py
+++ b/core/views/caves.py
@@ -555,6 +555,13 @@ def edit_entrance(request, path="", caveslug=None, entslug=None):
GET RID of all this entranceletter stuff. Far too overcomplexified.
We don't need it. Just the entrance slug is fine, then check uniqueness.
+
+ A whole new form is created just to edit the entranceletter.
+ To Do: put the entranceletter field on the Entrance, and delete the whole
+ CaveandEntrance class and form thing.
+ Don't use the existance of a CaveandEntrance object to see if the letter is valid,
+ just count the entrances instead.
+ We can do this simplification as troggle now assumes only 1 cave per entrance.
"""
def check_new_slugname_ok(slug, letter):
"""In Nov.2023 it is possible to create a 2nd entrance and not set an entrance letter,
@@ -808,9 +815,14 @@ def qm(request, cave_id, qm_id, year, grade=None, blockname=None):
Needs refactoring though! Uses extremely baroque way of getting the QMs instead of querying for QM objects
directly, presumably as a result of a baroque history.
- Many caves have several QMS with the same number, grade, year (2018) and first 8 chars of the survexblock. This crashes things, so the terminal char of the survexblock name was added
+ Many caves have several QMS with the same number, grade, year (2018) and first 8 chars of the survexblock.
+ This crashes things, so the terminal char of the survexblock name was added to disambiguate
"""
-
+
+ if not qm_id:
+ message = f"No qm_id specified {cave_id=} {year=} {blockname=}"
+ return render(request, "errors/generic.html", {"message": message})
+
year = int(year)
if blockname == "" or not blockname: