diff --git a/core/views/cave_kataster.py b/core/views/cave_kataster.py
index 3c7e02762..161c13f1b 100644
--- a/core/views/cave_kataster.py
+++ b/core/views/cave_kataster.py
@@ -30,7 +30,7 @@ def kataster(request, slug):
else:
return HttpResponseRedirect("/caves")
-
+ knum = 9999
cavename = str(cave) + ".html"
cave_data = Path( "cave_data", cavename )
@@ -44,7 +44,16 @@ def kataster(request, slug):
if str(ent.name).startswith(str(cave)):
print(ent.name)
entrance_data.append("entrance_data/"+ent.name)
- form = KatasterForm()
+
+ if request.method == "POST": # If the form has been submitted...
+ form = KatasterForm(request.POST) # A form bound to the POST data
+ if form.is_valid():
+ clean = form.cleaned_data
+ knum = clean['kataster_number']
+ print(f" # kataster_number {clean['kataster_number']}")
+ else: # GET and fall-through if POST is not valid
+ form = KatasterForm()
+
return render(
request,
"cave_kataster.html",
@@ -52,14 +61,13 @@ def kataster(request, slug):
"form": form,
"cave": cave,
"cave_data": cave_data, "entrance_data": entrance_data,
- "knum": "999",
- },
- )
+ "knum": knum,
+ }, )
class KatasterForm(forms.Form):
- areacode = forms.CharField(label='Full name', max_length=4, widget=forms.TextInput(attrs={'tabindex': 1, 'placeholder': '1623'}))
- official_name = forms.CharField(label='CUCC name', max_length=160,widget=forms.TextInput(attrs={'tabindex': 2, 'placeholder': '2012-ns-07'}))
- kataster_number= forms.CharField(max_length=10, widget=forms.TextInput(attrs={'tabindex': 3, 'placeholder': '999'}))
+ # areacode = forms.CharField(label='Full name', max_length=4, widget=forms.TextInput(attrs={'tabindex': 1, 'placeholder': '1623'}))
+ # official_name = forms.CharField(label='CUCC name', max_length=160,widget=forms.TextInput(attrs={'tabindex': 2, 'placeholder': '2012-ns-07'}))
+ kataster_number= forms.IntegerField(label="New kataster no.", widget=forms.TextInput(attrs={'tabindex': 1, 'size':1, 'placeholder': '9999'}))
"""
areacode = models.CharField(max_length=4, blank=True, null=True) # could use models.IntegerChoices
diff --git a/templates/cave_kataster.html b/templates/cave_kataster.html
index 532827e80..0dd99a391 100644
--- a/templates/cave_kataster.html
+++ b/templates/cave_kataster.html
@@ -8,15 +8,23 @@
Cave re-labelling from unofficial identifier to official Kataster number
-Cave '{{cave.official_name}}'
-{{cave.slug|safe}}
+
+
{% if cave.kataster_number %}
-This cave has already been "katastered". area:{{cave.areacode |safe}} number:{{cave.kataster_number |safe}}
+This cave has already been "katastered". area:{{cave.areacode |safe}} number:{{cave.kataster_number |safe}}
+
{% else %}
This cave needs to be "katastered". If you have the new number issued by the Austrians, we can do it now.
+
{% endif %}
Rename the .html files
@@ -29,15 +37,50 @@ This cave needs to be "katastered". If you have the new number issued by the Aus
-- Rename all the files listed above
+
- Edit the 'kataster'number' field inside the cave_data file.
- Edit the 'entranceslug' field inside each 'entrance' field in the cave_data file.
-
- Rename the directory (if it exists) inside the areacode directory, e.g. rename /{{cave.areacode}}/{{cave.unofficial_number}}/ as /{{cave.areacode}}/{{knum}}/ (if {{knum}} is the correct new kataster number)
+
- Rename all the files listed above - always do this last otherwise it is hard to automatically discover which edits have not been done.
+
+
+Rename the cave description directory
+
- Edit all the 'href=' URLS (if they exist) inside all the cave_data and entrance_data files descriptive text to refer to the new directory
-
- Find the survex files for this cave, rename them, and edit the *include inside the survex files to use the new kataster number
-
- Add the line "({{cave.slug|safe}}, {{cave.areacode |safe}}-{{knum}})," to the end of the file cave_data/cavealiases.txt
-
- find and report, but do not change, the '*_station' tags in each entrance_data file and in the fixed points files in the loser repo.
+
- Rename the directory (if it exists) inside the areacode directory, e.g. rename /{{cave.areacode}}/{{cave.unofficial_number}}/ as /{{cave.areacode}}/{{knum}}/ (if {{knum}} is the correct new kataster number). Do this last.
+
+
+Rename the survex directory
+
+- Find the survex files for this cave and edit the *include inside the survex files to use the new kataster number
+
- find and edit the '*_station' tags in each entrance_data file and in the fixed points files in the loser repo.
+
- Rename the survex files
+
- Run 'cavern caves-{{cave.areacode |safe}}/{{knum}}/{{knum}}.svx' and check it all works as you hope
+
- Run 'cavern caves-{{cave.areacode |safe}}/caves.svx' and check it all works as you hope
+
+
+Set the historic alias forwarder
+
+- Add the line
("{{cave.slug|safe}}", "{{cave.areacode |safe}}-{{knum}}"), to the end
+of the file cave_data/cavealiases.txt (don't forget the final comma)
Finally
-It is then vital to do a complete databaseReset as troggle has internally indexed all those {{cave.slug}} files, the indexes are now out of date and horrible things will happen when people try to use troggle with any cave that has been altered.
+
+- cd loser
+git add *
+git commit -m 'Katastering {{cave.slug|safe}} to {{cave.areacode |safe}}-{{knum}}'
+git pull
+git push
+cd ../expoweb
+git add *
+git commit -m 'Katastering {{cave.slug|safe}} to {{cave.areacode |safe}}-{{knum}}'
+git pull
+git push
+
+ - It is then vital to do a complete databaseReset as troggle has internally indexed all those {{cave.slug}} files, the indexes are now out of date and horrible things will happen when people try to use troggle with any cave that has been altered:
+uv run databaseReset reset K{{knum}}
+ - Look in the reset import warnings and errors report to see if anything has gone wrong:
+expo.survex.com/dataissues
+(in fact, look at this before you do any of this, so you can see what chnages.)
+
+
{% endblock %}