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'}))