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.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/core/views/caves.py b/core/views/caves.py
index 0349836..3fbc934 100644
--- a/core/views/caves.py
+++ b/core/views/caves.py
@@ -467,7 +467,7 @@ def get_entrances(request, caveslug):
return render(request,'options.html', {"items": [(e.entrance.slug(), e.entrance.slug()) for e in cave.entrances()]})
def caveQMs(request, slug):
- '''Lists the QMs on a particular cave
+ '''Lists all the QMs on a particular cave
relies on the template to find all the QMs for the cave specified in the slug, e.g. '1623-161'
Now working in July 2022
'''
@@ -482,7 +482,9 @@ def caveQMs(request, slug):
return render(request,'cave_qms.html', {'cave': cave})
def qm(request,cave_id,qm_id,year,grade=None):
- '''Not checked, tested or revised in 2022
+ '''Reports on one specific QM
+ Fixed and working July 2022, for both CSV imported QMs and for survex-imported QMs,
+ need refactoring though.
'''
year=int(year)
try:
@@ -493,6 +495,8 @@ def qm(request,cave_id,qm_id,year,grade=None):
return render(request, 'svxcaveseveral.html', {'settings': settings, "caves":caves })
except QM.DoesNotExist:
+ return render(request,'errors/badslug.html', {'badslug': f'{cave_id=} {year=} {qm_id=}'})
+
# Ouch, this does not look like what we want to do. We need to replace this with something better.
url=urllib.parse.urljoin(settings.URL_ROOT, r'/admin/core/qm/add/'+'?'+ r'number=' + qm_id)
if grade:
@@ -500,10 +504,11 @@ def qm(request,cave_id,qm_id,year,grade=None):
return HttpResponseRedirect(url)
def get_qms(request, caveslug):
- '''Not checked, tested or revised in 2022
+ '''Does not crash, but just returns a text list of the entrances for a cave.
+ Used internally by the JSON export code? Archeology required..
'''
try:
cave = Cave.objects.get(caveslug__slug = caveslug)
except:
return render(request,'errors/badslug.html', {'badslug': caveslug})
- return render(request,'options.html', {"items": [(e.entrance.slug(), e.entrance.slug()) for e in cave.entrances()]})
+ return render(request,'options.html', {"items": [(q.slug(), q.slug()) for q in cave.QMs()]})