summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/views/cave_kataster.py54
-rw-r--r--templates/cave_kataster.html32
2 files changed, 74 insertions, 12 deletions
diff --git a/core/views/cave_kataster.py b/core/views/cave_kataster.py
index b87ac66..dc06ea6 100644
--- a/core/views/cave_kataster.py
+++ b/core/views/cave_kataster.py
@@ -1,8 +1,12 @@
from pathlib import Path
import django.forms as forms
+from django.http import HttpResponseRedirect
from django.shortcuts import redirect, render
+
+import troggle.settings as settings
+
from troggle.core.utils import (
COOKIE_MAX_AGE,
WriteAndCommitError,
@@ -19,19 +23,55 @@ is 'katastered', ie.e moves from an informal number, such as
"""
def kataster(request, slug):
- cave = get_cave_from_slug(slug)
- form = KatasterForm()
- return render(
+ if cave := get_cave_from_slug(slug.lower()):
+ pass
+ elif cave := get_cave_from_slug(slug.upper()):
+ pass
+ else:
+ return HttpResponseRedirect("/caves")
+
+
+ cavename = str(cave) + ".html"
+
+ cave_data = Path( "cave_data", cavename )
+ if not (settings.EXPOWEB / cave_data).is_file:
+ cave_data = "does not exist"
+
+ ent_dir = settings.EXPOWEB / "entrance_data"
+
+ entrance_data = []
+ for ent in ent_dir.iterdir():
+ if str(ent.name).startswith(str(cave)):
+ print(ent.name)
+ entrance_data.append("entrance_data/"+ent.name)
+ form = KatasterForm()
+ return render(
request,
"cave_kataster.html",
{
"form": form,
"cave": cave,
+ "cave_data": cave_data, "entrance_data": entrance_data,
},
)
class KatasterForm(forms.Form):
- area = forms.CharField(label='Full name', max_length=100, widget=forms.TextInput(attrs={'tabindex': 1, 'placeholder': 'Anathema Device'}))
- officialname = forms.CharField(widget=forms.Textarea(attrs={'rows': 7, 'cols': 20, 'tabindex': 2, 'placeholder': 'The Airfield,\nTadfield'}))
- katasternum= forms.CharField(max_length=15, widget=forms.TextInput(attrs={'tabindex': 3, 'placeholder': '+44.1234567890'}))
- \ No newline at end of file
+ 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 = models.CharField(max_length=4, blank=True, null=True) # could use models.IntegerChoices
+ entrances = models.ManyToManyField("Entrance", through="CaveAndEntrance")
+ filename = models.CharField(max_length=200) # if a cave is 'pending' this is not set. Otherwise it is.
+ kataster_code = models.CharField(max_length=20, blank=True, null=True)
+ kataster_number = models.CharField(max_length=10, blank=True, null=True)
+ kataster_status = models.TextField(blank=True, null=True)
+ official_name = models.CharField(max_length=160)
+ survex_file = models.CharField(max_length=100, blank=True, null=True) # should be a foreign key?
+SURVEX_DATA = REPOS_ROOT_PATH / "loser"
+EXPOWEB = REPOS_ROOT_PATH / "expoweb"
+CAVEDESCRIPTIONS = EXPOWEB / "cave_data"
+ENTRANCEDESCRIPTIONS = EXPOWEB / "entrance_data"
+
+""" \ No newline at end of file
diff --git a/templates/cave_kataster.html b/templates/cave_kataster.html
index fc24246..38c8c81 100644
--- a/templates/cave_kataster.html
+++ b/templates/cave_kataster.html
@@ -1,18 +1,40 @@
{% extends "base.html" %}
{% block title %}Cave Kataster status report
-<!-- cave_debug.html - this text visible because this template has been included -->
+<!-- cave_kataster.html - this text visible because this template has been included -->
{% endblock %}
{% block content %}
-<h2>Caves kataster status</h2>
+<h2>Cave kataster status</h2>
+<h3>Cave</h3>
+<a href="/{{cave.url}}">{{cave.slug}}</a>
-{% if cave.kataster_status %}
-{{c.kataster_status |safe}}
+<p>
+{% if cave.kataster_number %}
+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 %}
-<a href="/{{cave.url}}">{{cave.slug}}</a>
+<h3>Rename the .html files</h3>
+<div style="font-family: monospace; font-weight: bold;">
+{{cave_data}}
+<p>
+{% for e in entrance_data %}
+{{e}}</br />
+{% endfor %}
+</div>
+
+<ul style="list-style: disc">
+<li> Rename all the files listed above
+<li> Edit the 'kataster'number' field inside the cave_data file.
+<li> Edit the 'entranceslug' field inside each 'entracne' field in the cave_data file.
+<li> Rename the directory (if it exists) inside the areacode directory, e.g. inside /1623/
+<li> 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
+<li> Find the survex files for this cave, rename them, and edit the *include inside the survex files to use the new kataster number
+<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.
+</ul>
{% endblock %}