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

View File

@ -56,21 +56,30 @@ ul {list-style: disc}
<h3>Unfinished wallets work to do:</h3>
<a href="/expofiles/surveyscans/2016/walletindex.html">2016 wallets</a><br>
<a href="/expofiles/surveyscans/2017/walletindex.html">2017 wallets</a><br>
<a href="/expofiles/surveyscans/2018/walletindex.html">2018 wallets</a><br>
<a href="/expofiles/surveyscans/2019/walletindex.html">2019 wallets</a><br>
<ul>
<li><a href="/expofiles/surveyscans/2016/walletindex.html">2016 wallets</a><br>
<li><a href="/expofiles/surveyscans/2017/walletindex.html">2017 wallets</a><br>
<li><a href="/expofiles/surveyscans/2018/walletindex.html">2018 wallets</a><br>
<li><a href="/expofiles/surveyscans/2019/walletindex.html">2019 wallets</a><br>
</ul>
<h3>Upload new data</h3>
<ul>
<li><a style="color:grey"href="/dwgupload/">Upload a Tunnel or Therion drawing</a></li>
<li><a style="color:grey"href="/scanupload/2022:00">Upload a scan into a survey wallet</a></li>
<li><a style="color:grey"href=""><font style="color:grey">Upload a photo</font></a></li>
<li><a style="color:grey" href="">Upload a GPS track</a></li>
<li><a style="color:grey"href="">Upload a Tunnel or Therion drawing</a></li>
<li><a href="/survexfile/caves-1623/999/999.svx">Upload or type in a Survex file</a> - overwrite the area/number data in the browser title bar after the page loads, from 'caves-1623/999/999.svx' to whatever you need for your cave.
<li><a href="/survexfile/caves-1623/999/999.svx">Upload or type in a Survex file</a> - rewrite the area/number data in the browser title bar,
from 'caves-1623/999/999.svx' to the new number
<li><a href="/cave/1623-6/edit/">Register a new cave</a> or edit an old one
<li><a href="/entrance/new/1623-6">Register a new entrance to an existing cave</a>
</ul>
<p><font style="color:grey">Yes, easy forms for uploading photos and GPX files are being developed, but are not ready for this coming expo:</font>
<ul>
<li><a style="color:grey"href="/handbook/computing/uploading.html"><font style="color:grey">Upload a photo</font></a></li>
<li><a style="color:grey" href="/handbook/computing/gpxupload.html"><font style="color:grey">Upload a GPS track</font></a></li>
</ul>
<p>
<!-- 2006-era early troggle stuff, never implemented?
<h3>Unfinished surveys</h3>
{% for survey in surveys_unfinished %}
<li>{{survey|link}}</li>
@ -84,7 +93,7 @@ ul {list-style: disc}
{% empty %}
[none found in database[qms_recommended]]
{% endfor %}
-->
{% endblock content %}
{% block margins %}