mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 18:37:05 +00:00
Katastering, list files
This commit is contained in:
@@ -1,8 +1,12 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import django.forms as forms
|
import django.forms as forms
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
|
|
||||||
|
import troggle.settings as settings
|
||||||
|
|
||||||
from troggle.core.utils import (
|
from troggle.core.utils import (
|
||||||
COOKIE_MAX_AGE,
|
COOKIE_MAX_AGE,
|
||||||
WriteAndCommitError,
|
WriteAndCommitError,
|
||||||
@@ -19,19 +23,55 @@ is 'katastered', ie.e moves from an informal number, such as
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def kataster(request, slug):
|
def kataster(request, slug):
|
||||||
cave = get_cave_from_slug(slug)
|
if cave := get_cave_from_slug(slug.lower()):
|
||||||
form = KatasterForm()
|
pass
|
||||||
return render(
|
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,
|
request,
|
||||||
"cave_kataster.html",
|
"cave_kataster.html",
|
||||||
{
|
{
|
||||||
"form": form,
|
"form": form,
|
||||||
"cave": cave,
|
"cave": cave,
|
||||||
|
"cave_data": cave_data, "entrance_data": entrance_data,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
class KatasterForm(forms.Form):
|
class KatasterForm(forms.Form):
|
||||||
area = forms.CharField(label='Full name', max_length=100, widget=forms.TextInput(attrs={'tabindex': 1, 'placeholder': 'Anathema Device'}))
|
areacode = forms.CharField(label='Full name', max_length=4, widget=forms.TextInput(attrs={'tabindex': 1, 'placeholder': '1623'}))
|
||||||
officialname = forms.CharField(widget=forms.Textarea(attrs={'rows': 7, 'cols': 20, 'tabindex': 2, 'placeholder': 'The Airfield,\nTadfield'}))
|
official_name = forms.CharField(label='CUCC name', max_length=160,widget=forms.TextInput(attrs={'tabindex': 2, 'placeholder': '2012-ns-07'}))
|
||||||
katasternum= forms.CharField(max_length=15, widget=forms.TextInput(attrs={'tabindex': 3, 'placeholder': '+44.1234567890'}))
|
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"
|
||||||
|
|
||||||
|
"""
|
||||||
@@ -1,18 +1,40 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}Cave Kataster status report
|
{% 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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% 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 %}
|
<p>
|
||||||
{{c.kataster_status |safe}}
|
{% 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 %}
|
{% 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 %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user