summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-05-04 14:16:48 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-05-04 14:16:48 +0100
commit56c3517328e32e64d2f0e16f3bbe811e53896a85 (patch)
treee0cf772ade888fcc3cf292c085a550d1b00cb51a
parent90bb0759a082755c55083f83bf029a44d225e013 (diff)
downloadtroggle-56c3517328e32e64d2f0e16f3bbe811e53896a85.tar.gz
troggle-56c3517328e32e64d2f0e16f3bbe811e53896a85.tar.bz2
troggle-56c3517328e32e64d2f0e16f3bbe811e53896a85.zip
fixed url ambiguity by rename
-rw-r--r--core/TESTS/tests.py10
-rw-r--r--core/views/drawings.py2
-rw-r--r--templates/base.html2
-rw-r--r--urls.py16
4 files changed, 19 insertions, 11 deletions
diff --git a/core/TESTS/tests.py b/core/TESTS/tests.py
index b376840..b8340c2 100644
--- a/core/TESTS/tests.py
+++ b/core/TESTS/tests.py
@@ -400,6 +400,16 @@ class PageTests(TestCase):
phmatch = re.search(ph, content)
self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
+ def test_page_dwgallfiles_empty(self):
+ # this gets an empty page as the database has not been loaded
+ response = self.client.get('/dwgfiles/')
+ self.assertEqual(response.status_code, 200)
+ content = response.content.decode()
+ for ph in [ r'All Tunnel and Therion files',
+ r'<th>Scans folder</th><th>Scan files</th><th>Frames</th></tr>']:
+ phmatch = re.search(ph, content)
+ self.assertIsNotNone(phmatch, "Failed to find expected text: '" + ph +"'")
+
def test_page_slash_empty(self):
# tslash where there should not be one
response = self.client.get('/expedition/1979/')
diff --git a/core/views/drawings.py b/core/views/drawings.py
index 19507b9..f0b684a 100644
--- a/core/views/drawings.py
+++ b/core/views/drawings.py
@@ -19,7 +19,7 @@ need to check if invalid query string is invalid, or produces multiple replies
and render a user-friendly error page.
'''
-def dwgdata(request):
+def dwgallfiles(request):
'''Report on all the drawing files in the system. These were loaded by parsing the entire directory tree
'''
dwgfiles = DrawingFile.objects.all()
diff --git a/templates/base.html b/templates/base.html
index a1e9f6b..f386027 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -31,7 +31,7 @@
<a href="{% url "survexcaveslist" %}">All Survex</a> |
<a href="{% url "allwallets" %}">Scans</a> |
<a href="{% url "scanupload" '2021:01' %}">Upload Scans</a> |
- <a href="{% url "dwgdata" %}">Drawings</a> |
+ <a href="{% url "dwgallfiles" %}">Drawings</a> |
<a href="/1623/290/290.html">290 (FGH)</a> |
<a href="/1623/291/291">291 (GSH)</a> |
<a href="/1623/204/204.html">204 (Steinbr&uuml;cken)</a> |
diff --git a/urls.py b/urls.py
index 1d5c9c9..f3092a8 100644
--- a/urls.py
+++ b/urls.py
@@ -10,7 +10,7 @@ from django.urls import reverse, resolve
from troggle.core.views import caves, statistics, survex
from troggle.core.views.scans import scansingle, singlewallet, allwallets
-from troggle.core.views.drawings import dwgdata, dwgfilesingle
+from troggle.core.views.drawings import dwgallfiles, dwgfilesingle
from troggle.core.views.drawings import dwgfileupload
from troggle.core.views.other import dwgupload
from troggle.core.views.other import troggle404, frontpage, todos, controlpanel, frontpage, scanupload
@@ -81,8 +81,9 @@ trogglepatterns = [
re_path(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/).
re_path(r'^admin/', admin.site.urls), # includes admin login & logout urls
- path('scanupload/<wallet>', scanupload, name='scanupload'),
- path('dwgupload/<path:folder>', dwgupload, name='dwgupload'),
+# Uploads - uploading a file
+ path('scanupload/<wallet>', scanupload, name='scanupload'), # wallet=2020#01, not a path
+ path('dwgupload/<path:folder>', dwgupload, name='dwgupload'),
path('dwgupload/', dwgupload, name='dwgupload'),
# setting LOGIN_URL = '/accounts/login/' is default
@@ -157,12 +158,9 @@ trogglepatterns = [
path('survey_scans/<path:path>/<file>', scansingle, name="scansingle"),
# The tunnel and therion drawings files pages
- re_path(r'^dwgdata/$', dwgdata, name="dwgdata"),
- re_path(r'^dwgdataraw/(?P<path>.+?\.xml)$', dwgfilesingle, name="dwgfilesingle"),
- re_path(r'^dwgdataraw/(?P<path>.+?\.th)$', dwgfilesingle, name="dwgfilesingle"),
- re_path(r'^dwgdataraw/(?P<path>.+?\.th2)$', dwgfilesingle, name="dwgfilesingle"),
-# re_path(r'^dwgdatainfo/(?P<path>.+?\.xml)$', dwgfileinfo, name="dwgfileinfo"), # parses tunnel for info & ref to wallet
-# re_path(r'^dwgdataraw/(?P<path>.+?\.xml)/upload$', dwgfileupload, name="dwgfileupload"), # Not working
+ path('dwgfiles', dwgallfiles, name="dwgallfiles"),
+ path('dwgdataraw/<path:path>', dwgfilesingle, name="dwgfilesingle"),
+# path('dwgdataraw/<path:path>/upload', dwgfileupload, name="dwgfileupload"), # Not working
# QMs pages - must precede other /caves pages?