mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-05-12 20:20:25 +01:00
Login and git editor string now working
This commit is contained in:
+2
-1
@@ -598,7 +598,8 @@ def cavepage(request, karea=None, subpath=None):
|
||||
|
||||
@login_required_if_public
|
||||
def edit_cave(request, path="", slug=None):
|
||||
"""This is the form that edits all the cave data and writes out an XML file in the :expoweb: repo folder
|
||||
"""This is the form that edits all the cave data and writes out
|
||||
an XML (html) file in the :expoweb: repo folder
|
||||
The format for the file being saved is in templates/dataformat/cave.xml
|
||||
|
||||
It saves the data into into the database and into the html file, which it then commits to git.
|
||||
|
||||
+21
-4
@@ -83,7 +83,9 @@ class NewHoleForm(forms.Form):
|
||||
# Media: Entrance Photo (Replaced dropdown with checkboxes)
|
||||
photo_ent_no = forms.BooleanField(label="Entrance photos ?", required=False)
|
||||
photo_ent_who = forms.CharField(label="Who has photos of entrance, tag and GPS?", required=False)
|
||||
|
||||
|
||||
identified_login = forms.BooleanField(required=False,widget=forms.CheckboxInput(attrs={"onclick":"return false"})) # makes it readonly
|
||||
|
||||
who_are_you = forms.CharField(strip=True,
|
||||
label="Who are you ? (You do not need to have been on this trip)",
|
||||
required=True,
|
||||
@@ -311,10 +313,12 @@ class NewHoleForm(forms.Form):
|
||||
from textwrap import dedent
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib import messages
|
||||
from .auth import login_required_if_public
|
||||
|
||||
@login_required_if_public
|
||||
def new_hole(request):
|
||||
identified_login = is_identified_user(request.user)
|
||||
editor_id = get_editor(request)
|
||||
editor = get_editor(request)
|
||||
|
||||
areatext = None
|
||||
if request.method == 'POST':
|
||||
@@ -328,13 +332,16 @@ def new_hole(request):
|
||||
areatext = "Not in 1623 or 1626"
|
||||
|
||||
if form.is_valid():
|
||||
editor = form.cleaned_data["who_are_you"]
|
||||
editor = git_string(editor)
|
||||
process_new_hole(form, area)
|
||||
messages.success(request, "New prospect save data successfully saved.")
|
||||
|
||||
success_url = "/walletedit/" + form.cleaned_data.get('survey_wallet').replace("#",":")
|
||||
return redirect(success_url)
|
||||
# GET
|
||||
else:
|
||||
form = NewHoleForm()
|
||||
form = NewHoleForm(initial={"identified_login": identified_login, "who_are_you":editor})
|
||||
|
||||
return render(request, 'new_hole.html', {'form': form,
|
||||
"identified_login": identified_login,
|
||||
@@ -363,6 +370,8 @@ def get_auto_file():
|
||||
|
||||
def process_new_hole(form, area):
|
||||
"""
|
||||
🚧 under construction.
|
||||
|
||||
⚡Detect if logged-in & set who_am_i using the cookie system, make read-only if logged in
|
||||
|
||||
✅ Create a fixed point *fix record by inserting into :loser:/fixedpts/gps/auto.svx
|
||||
@@ -372,8 +381,16 @@ def process_new_hole(form, area):
|
||||
⚡Update the database with this new Cave
|
||||
⚡Update the database with this new Entrance
|
||||
⚡Do a git commit (expoweb) of the new Cave and Entrance description files
|
||||
⚡+ Link page to go to
|
||||
Entrance (upload approach & photos, already done Other Station location),
|
||||
Wallet (auto-set related Cave & People)
|
||||
GPSlog upload
|
||||
Logbook entry for the trip (date, people)
|
||||
Cave (if cave description, but probably not)
|
||||
Survex new (needs new creation page) (date, people, cave id)
|
||||
+ list of "happened this day" at the bottom, as for other pages.
|
||||
|
||||
⚡Update the database "locations" with the new *fix (is this even possible without reset?)
|
||||
⚡Update the database "locations" with the new *fix (is this even possible 🧩 without reset?)
|
||||
|
||||
writes:
|
||||
*fix 1623.g2025-bz-06 47.6964481 13.816103 0
|
||||
|
||||
Reference in New Issue
Block a user