fixed url ambiguity by rename

This commit is contained in:
Philip Sargent 2021-05-04 14:16:48 +01:00
parent 90bb0759a0
commit 56c3517328
4 changed files with 19 additions and 11 deletions

View File

@ -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/')

View File

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

View File

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

16
urls.py
View File

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