diff options
-rw-r--r-- | core/views/cave_kataster.py | 24 | ||||
-rw-r--r-- | templates/cave_kataster.html | 61 |
2 files changed, 68 insertions, 17 deletions
diff --git a/core/views/cave_kataster.py b/core/views/cave_kataster.py index 3c7e027..161c13f 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 532827e..0dd99a3 100644 --- a/templates/cave_kataster.html +++ b/templates/cave_kataster.html @@ -8,15 +8,23 @@ <h2>Cave re-labelling from unofficial identifier to official Kataster number</h2> -<h3>Cave '{{cave.official_name}}'</h3> -<a href="/{{cave.url|safe}}">{{cave.slug|safe}}</a> +<h3>Cave <a href="/{{cave.url|safe}}">{{cave.slug|safe}}</a> '{{cave.official_name|safe}}'</h3> + <p> {% if cave.kataster_number %} -This cave has already been "katastered". area:{{cave.areacode |safe}} number:{{cave.kataster_number |safe}} +<b>This cave has already been "katastered". area:{{cave.areacode |safe}} number:{{cave.kataster_number |safe}} +</b> {% else %} This cave needs to be "katastered". If you have the new number issued by the Austrians, we can do it now. + <form action="{% url 'kataster' cave.slug %}" method="post"> +{% csrf_token %} +{{form.as_p}} + <button class="fancybutton" style="padding: 0.5em 25px; font-size: 100%;" type = "submit" > + See what the edits look like → + </button> +</form> {% endif %} <h3>Rename the .html files</h3> @@ -29,15 +37,50 @@ This cave needs to be "katastered". If you have the new number issued by the Aus </div> <ul style="list-style: disc"> -<li> Rename all the files listed above + <li> Edit the '<samp>kataster'number</samp>' field inside the <samp>cave_data</samp> file. <li> Edit the '<samp>entranceslug</samp>' field inside each '<samp>entrance</samp>' field in the <samp>cave_data</samp> file. -<li> Rename the directory (if it exists) inside the areacode directory, e.g. rename <samp>/{{cave.areacode}}/{{cave.unofficial_number}}/</samp> as <samp>/{{cave.areacode}}/{{knum}}/</samp> (if {{knum}} is the correct new kataster number) +<li> Rename all the files listed above - always do this <b>last</b> otherwise it is hard to automatically discover which edits have not been done. +</ul> + +<h3>Rename the cave description directory</h3> +<ul style="list-style: disc"> <li> Edit all the '<samp>href=</samp>' <small>URLS</small> (if they exist) inside all the <samp>cave_data</samp> and <samp>entrance_data</samp> files descriptive text to refer to the new directory -<li> Find the survex files for this cave, rename them, and edit the <samp>*include</samp> inside the survex files to use the new kataster number -<li> Add the line "<samp>({{cave.slug|safe}}, {{cave.areacode |safe}}-{{knum}}),</samp>" to the end of the file <var>cave_data/cavealiases.txt</var> -<li> 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. +<li> Rename the directory (if it exists) inside the areacode directory, e.g. rename <samp>/{{cave.areacode}}/{{cave.unofficial_number}}/</samp> as <samp>/{{cave.areacode}}/{{knum}}/</samp> (if {{knum}} is the correct new kataster number). Do this last. +</ul> + +<h3>Rename the survex directory</h3> +<ul style="list-style: disc"> +<li> Find the survex files for this cave and edit the <samp>*include</samp> inside the survex files to use the new kataster number +<li> find and edit the '*_station' tags in each entrance_data file and in the fixed points files in the loser repo. +<li> Rename the survex files +<li> Run <samp>'cavern caves-{{cave.areacode |safe}}/{{knum}}/{{knum}}.svx'</samp> and check it all works as you hope +<li> Run <samp>'cavern caves-{{cave.areacode |safe}}/caves.svx' </samp> and check it all works as you hope +</ul> + +<h3>Set the historic alias forwarder</h3> +<ul style="list-style: disc"> +<li> Add the line <br /><samp>("{{cave.slug|safe}}", "{{cave.areacode |safe}}-{{knum}}"),</samp></br /> to the end +of the file <var><a href="/cave_data/cavealiases.txt_edit">cave_data/cavealiases.txt</a></var> (don't forget the final comma) </ul> <h3>Finally</h3> -<p>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. +<ul style="list-style: disc"> +<li><samp>cd loser<br /> +git add *<br /> +git commit -m 'Katastering {{cave.slug|safe}} to {{cave.areacode |safe}}-{{knum}}'<br /> +git pull<br /> +git push<br /> +cd ../expoweb<br /> +git add *<br /> +git commit -m 'Katastering {{cave.slug|safe}} to {{cave.areacode |safe}}-{{knum}}'<br /> +git pull<br /> +git push<br /> +</samp> +<li>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:<br /> +<samp>uv run databaseReset reset K{{knum}}</samp> +<li>Look in the reset import warnings and errors report to see if anything has gone wrong: +<var><a href="http://expo.survex.com/dataissues">expo.survex.com/dataissues</a></var><br /> +(in fact, look at this before you do any of this, so you can see what chnages.) +</ul> + {% endblock %} |