mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-01-19 14:02:56 +00:00
Initial Cave Kayaster STatus form
This commit is contained in:
37
core/views/cave_kataster.py
Normal file
37
core/views/cave_kataster.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from pathlib import Path
|
||||
|
||||
import django.forms as forms
|
||||
|
||||
from django.shortcuts import redirect, render
|
||||
from troggle.core.utils import (
|
||||
COOKIE_MAX_AGE,
|
||||
WriteAndCommitError,
|
||||
current_expo,
|
||||
get_cookie,
|
||||
git_string,
|
||||
write_and_commit,
|
||||
)
|
||||
from troggle.core.views.caves import get_cave_from_slug
|
||||
|
||||
"""Forms to handle renaming files and editing contents when a cave
|
||||
is 'katastered', ie.e moves from an informal number, such as
|
||||
1623-2024-BL-10 to 1623-999
|
||||
"""
|
||||
|
||||
def kataster(request, slug):
|
||||
cave = get_cave_from_slug(slug)
|
||||
form = KatasterForm()
|
||||
return render(
|
||||
request,
|
||||
"cave_kataster.html",
|
||||
{
|
||||
"form": form,
|
||||
"cave": cave,
|
||||
},
|
||||
)
|
||||
|
||||
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'}))
|
||||
|
||||
18
templates/cave_kataster.html
Normal file
18
templates/cave_kataster.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Cave Kataster status report
|
||||
<!-- cave_debug.html - this text visible because this template has been included -->
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
|
||||
<h2>Caves kataster status</h2>
|
||||
|
||||
|
||||
{% if cave.kataster_status %}
|
||||
{{c.kataster_status |safe}}
|
||||
{% endif %}
|
||||
|
||||
<a href="/{{cave.url}}">{{cave.slug}}</a>
|
||||
{% endblock %}
|
||||
2
urls.py
2
urls.py
@@ -23,6 +23,7 @@ from troggle.core.views.caves import (
|
||||
get_entrances,
|
||||
qm,
|
||||
)
|
||||
from troggle.core.views.cave_kataster import (kataster)
|
||||
from troggle.core.views.drawings import dwgallfiles, dwgfilesingle
|
||||
from troggle.core.views.editor_helpers import image_selector, new_image_form
|
||||
from troggle.core.views.expo import (
|
||||
@@ -204,6 +205,7 @@ trogglepatterns = [
|
||||
# Cave description pages
|
||||
path('cave/<slug:slug>', caveslugfwd, name="caveslugfwd"),
|
||||
path('cave_debug', cave_debug, name="cave_debug"),
|
||||
path('kataster/<slug:slug>', kataster, name="kataster"),
|
||||
re_path(r'^newcave/$', edit_cave, name="newcave"),
|
||||
re_path(r'^cave/3d/(?P<cave_id>[^/]+).3d$', cave3d, name="cave3d"),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user