summaryrefslogtreecommitdiffstats
path: root/core/views/uploads.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-03-08 22:59:04 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2022-03-08 22:59:04 +0000
commit488ce46d7314235a53e703eff6cf12870ccba044 (patch)
treef9697977a2f28e1e567852c458de93f1ac31f707 /core/views/uploads.py
parentf32df567f27185472a96727ce058715653c97294 (diff)
downloadtroggle-488ce46d7314235a53e703eff6cf12870ccba044.tar.gz
troggle-488ce46d7314235a53e703eff6cf12870ccba044.tar.bz2
troggle-488ce46d7314235a53e703eff6cf12870ccba044.zip
File upload forms descriptions
Diffstat (limited to 'core/views/uploads.py')
-rw-r--r--core/views/uploads.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py
index 9301aba..a052835 100644
--- a/core/views/uploads.py
+++ b/core/views/uploads.py
@@ -24,7 +24,19 @@ from .auth import login_required_if_public
'''
todo = '''
--Move upload forms to proper file locations
+- Write equivalent photo upload form system, similar to scanupload() but in expofiles/photos/
+ Need to validate it as being a valid image file, not a dubious script or hack
+
+- Write equivalent GPX upload form system, similar to scanupload() but in expofiles/gpslogs/
+ Need to validate it as being a valid GPX file using an XML parser, not a dubious script or hack
+
+- Validate Tunnel & Therion files using an XML parser in dwgupload()
+
+- Validate image files using a magic recogniser in scanupload()
+
+- Enable folder creation in dwguploads or as a separate form
+
+- Register uploaded filenames in the Django db without needing to wait for a reset & bulk file import
'''
class FilesForm(forms.Form): # not a model-form, just a form-form
@@ -34,6 +46,7 @@ class FilesForm(forms.Form): # not a model-form, just a form-form
def scanupload(request, wallet=None):
'''Upload scanned image files into a wallet on /expofiles
This does NOT use a Django model linked to a Django form. Just a simple Django form.
+ You will find the Django documentation on forms very confusing, This is simpler.
'''
filesaved = False
actual_saved = []
@@ -104,8 +117,14 @@ def scanupload(request, wallet=None):
@login_required_if_public
def dwgupload(request, folder=None, gitdisable='no'):
- '''Upload DRAWING files (tunnel or therion) into the upload folder in :drawings:
+ '''Upload DRAWING files (tunnel or therion) into the upload folder in :drawings
+ AND registers it into the :drawings: git repo.
+
This does NOT use a Django model linked to a Django form. Just a simple Django form.
+ You will find the Django documentation on forms very confusing, This is simpler.
+
+ Need to validate it as being a valid GPX file using an XML parser, not a dubious script or hack
+
We use get_or_create instead of simply creating a new object in case someone uploads the same file
several times in one session, and expects them to be overwritten in the database. Although