2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 09:57:22 +00:00

File upload forms descriptions

This commit is contained in:
Philip Sargent
2022-03-08 22:59:04 +00:00
parent f32df567f2
commit 488ce46d73
2 changed files with 40 additions and 12 deletions

View File

@@ -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