summaryrefslogtreecommitdiffstats
path: root/core/views/uploads.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views/uploads.py')
-rw-r--r--core/views/uploads.py38
1 files changed, 37 insertions, 1 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py
index 7265fff..2ee01f3 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -146,9 +146,45 @@ 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 ExpotextfileForm(forms.Form): # not a model-form, just a form-form
+ text = 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)
-
+
+def edittxtpage(request, path, filepath):
+ """Editing a .txt file on expoweb/
+ """
+ def simple_get():
+ form = ExpotextfileForm()
+ return render(
+ request,
+ "textfileform.html",
+ {
+ "form": form,
+ "path": path,
+ "filepath": filepath,
+ "text": text,
+ },
+ )
+
+ if not filepath.is_file():
+ print(f"Not a file: {filepath}")
+ errpage = f"<html>" + default_head + f"<h3>File not found '{filepath}'<br><br>failure detected in expowebpage() in views.expo.py</h3> </body>"
+ return HttpResponse(errpage)
+ try:
+ with open(filepath) as f:
+ text = f.read()
+ except IOError:
+ print("### File reading failue, but it exists.. ### ", filepath)
+ filefound = False
+
+ if request.method == "GET":
+ return simple_get()
+
+ elif request.method == "POST":
+ pass
+
@login_required_if_public
def logbookedit(request, year=None, slug=None):
"""Edit a logbook entry