From 9269d1ec5283e13b57b7bcb41ef59c8f02c99a2f Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 6 Aug 2023 13:47:09 +0300 Subject: [PATCH] Logbook entry initial form --- core/views/uploads.py | 23 +++++++++++ templates/logbookform.html | 79 ++++++++++++++++++++++++++++++++++++++ urls.py | 4 +- 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 templates/logbookform.html diff --git a/core/views/uploads.py b/core/views/uploads.py index 6b6b007..cdc633b 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -52,6 +52,29 @@ class TextForm(forms.Form): # not a model-form, just a form-form class ExpofileRenameForm(forms.Form): # not a model-form, just a form-form renameto = forms.CharField(strip=True, required=False) +class LogbookEditForm(forms.Form): # not a model-form, just a form-form + author = forms.CharField(strip=True, required=False) + +@login_required_if_public +def logbookedit(request, year=None): + """Type in a logbook entry. + No editing yet, name is implying a future enhancement + """ + author = "Zonker" + if not year: + year = 2023 + form = LogbookEditForm() + return render( + request, + "logbookform.html", + { + "form": form, + "year": year, + "author": author, + }, + ) + + @login_required_if_public def expofilerename(request, filepath): """Rename any single file in /expofiles/ - eventually. diff --git a/templates/logbookform.html b/templates/logbookform.html new file mode 100644 index 0000000..cc338b3 --- /dev/null +++ b/templates/logbookform.html @@ -0,0 +1,79 @@ +{% extends "base.html" %} + +{% block title %}New Logbook Entry form{% endblock %} + +{% block content %} + +

New Logbook Entry in {{year}}

+ + {% if save_bad %} +

+ + Cannot save to '{{save_bad}}' as a file of that name already exists here. +

+ {% endif %} + +
+ +
+ {% csrf_token %} +
+ + + +

+ + +

+ + +

+ + +

+ + +

+ + + +


+ +
+ +


+ Full logbook for this year: Logbook {{year}} + +
+ +
+ +
+ + +{% endblock %} \ No newline at end of file diff --git a/urls.py b/urls.py index f415e6d..b398690 100644 --- a/urls.py +++ b/urls.py @@ -24,7 +24,7 @@ from troggle.core.views.other import (controlpanel, exportlogbook, frontpage, from troggle.core.views.prospect import prospecting from troggle.core.views.scans import (allscans, cavewallets, scansingle, walletslistperson, walletslistyear) -from troggle.core.views.uploads import dwgupload, photoupload, expofilerename +from troggle.core.views.uploads import dwgupload, photoupload, expofilerename, logbookedit from troggle.core.views.wallets_edit import walletedit """This sets the actualurlpatterns[] and urlpatterns[] lists which django uses to resolve urls - in both directions as these are declarative. @@ -109,6 +109,8 @@ trogglepatterns = [ path('dwgupload/', dwgupload, name='dwgupload'), path('dwguploadnogit/', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing path('dwguploadnogit/', dwgupload, {'gitdisable': 'yes'}, name='dwguploadnogit'), # used in testing + path('logbookedit/', logbookedit, name='logbookedit'), + path('logbookedit/', logbookedit, name='logbookedit'), # year=2023 # Renaming an uploaded file path('expofilerename/', expofilerename, name='expofilerename'),