From 39683cc4135db7ad3709b988f6a5b8972b82d8d0 Mon Sep 17 00:00:00 2001 From: Philip Sargent <philip.sargent@klebos.com> Date: Tue, 11 Oct 2022 21:01:02 +0300 Subject: [PATCH] TIdy and docum of cave entry code --- core/views/caves.py | 11 ----------- core/views/survex.py | 2 +- templates/dataformat/cave.xml | 7 +++++-- templates/dataformat/entrance.xml | 4 +++- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/core/views/caves.py b/core/views/caves.py index 960d373..acd75a6 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -303,7 +303,6 @@ def edit_cave(request, path = "", slug=None): The format for the file being saved is in templates/dataformat/cave.xml It does save the data into into the database directly, not by parsing the file. - It does NOT yet commit to the git repo ''' message = "" if slug is not None: @@ -525,13 +524,3 @@ def qm(request,cave_id,qm_id,year,grade=None, blockname=None): return render(request,'errors/badslug.html', {'badslug': f'QM.DoesNotExist blockname is not empty string {cave_id=} {year=} {qm_id=} {grade=} {blockname=}'}) -# def get_qms(request, caveslug): - # '''Does not crash, but just returns a text list of the entrances for a cave. - # Used internally by the JSON export code? Archeology required.. - # cf get_entrances() above - # ''' - # try: - # cave = Cave.objects.get(caveslug__slug = caveslug) - # except: - # return render(request,'errors/badslug.html', {'badslug': caveslug}) - # return render(request,'options.html', {"items": [(q.slug(), q.slug()) for q in cave.QMs()]}) diff --git a/core/views/survex.py b/core/views/survex.py index dc225bd..b6548b6 100644 --- a/core/views/survex.py +++ b/core/views/survex.py @@ -459,7 +459,7 @@ def survexcaveslist(request): def survexcavesingle(request, survex_cave): '''parsing all the survex files of a single cave and showing that it's consistent and can find all - the files and people. Should explicity fix the kataster number thing. + the files and people. Should explicitly fix the kataster number thing. kataster numbers are not unique across areas. This used to be a db constraint but we need to manage this ourselves as we don't want the parser aborting with an error message. diff --git a/templates/dataformat/cave.xml b/templates/dataformat/cave.xml index 0e5fc9b..314e5db 100644 --- a/templates/dataformat/cave.xml +++ b/templates/dataformat/cave.xml @@ -1,13 +1,16 @@ <!DOCTYPE html> -<!-- This file is generated using the form documented at /handbook/survey/caveentry.html --> +<!-- This file is generated by troggle using the form documented at /handbook/survey/caveentry.html --> <!-- Only put one cave in this file --> -<!-- If you edit this 1623-000.html file by hand, make sure you update the database by doing a full data import --> +<!-- If you edit this 1623-nnn.html file by hand, make sure you update the database by doing a full data import --> <!-- ALTERNATIVELY you can download an example template from expoweb/templates/cave_data.html --> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head> <body> +<b>This file is generated by troggle</b> using the form documented at /handbook/survey/caveentry.html +<br> + <cave> <non_public>{{ cave.non_public }}</non_public>{% for slug in cave.caveslug_set.all %}<!-- 'False' or 'True'. True if the cave should only be visible to logged-in users. Caves are normally public, so enter 'False' unless you know otherwise. --> <caveslug>{{ slug.slug|default_if_none:"1623-000"|safe }}</caveslug>{% endfor %}<!--(Required). Internal I.D. used to refer to this cave in entrance data files. Typically the same as the filebase, e.g. '1623-195' --> diff --git a/templates/dataformat/entrance.xml b/templates/dataformat/entrance.xml index e325c2b..2551a57 100644 --- a/templates/dataformat/entrance.xml +++ b/templates/dataformat/entrance.xml @@ -1,6 +1,6 @@ <!DOCTYPE html> <!-- Only put one entrance in this file --> -<!-- This file is generated using the form documented at /handbook/survey/caveentry.html --> +<!-- This file is generated by troggle using the form documented at handbook/survey/ententry.html --> <!-- If you edit this file by hand, make sure you update the database by doing a full data import --> <!-- See http://expo.survex.com/handbook/survey/caveentryfields.html for current details on filling in this form --> @@ -12,6 +12,8 @@ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head> <body> +<b>This file is generated by troggle </b>using the form documented at handbook/survey/ententry.html +<br> <entrance> <non_public>{{ entrance.non_public }}</non_public>{% for slug in entrance.entranceslug_set.all %} <slug>{{ slug.slug|default_if_none:""|safe }}</slug>{% endfor %}