From 821aaa1f66b003c34a8d568ff1dfdae057c17091 Mon Sep 17 00:00:00 2001 From: Philip Sargent <philip.sargent@klebos.com> Date: Tue, 27 Apr 2021 19:02:11 +0100 Subject: [PATCH] Changing to new path() url function (initial) --- core/context.py | 2 +- urls.py | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/core/context.py b/core/context.py index 9ad13d1..9ac1f60 100644 --- a/core/context.py +++ b/core/context.py @@ -1,7 +1,7 @@ from django.conf import settings from troggle.core.models.troggle import Expedition -'''This is the only troglle-specific 'context processor' that troggle uses +'''This is the only troggle-specific 'context processor' that troggle uses in the processing of Django templates This seems to mean that every page produced has bundled in its context the complete 'settings' and diff --git a/urls.py b/urls.py index af40f06..23f63af 100644 --- a/urls.py +++ b/urls.py @@ -121,36 +121,36 @@ trogglepatterns = [ re_path(r'^entrance/new/(?P<caveslug>[^/]+)$', caves.edit_entrance, name = "newentrance"), # System admin and monitoring - re_path(r'^statistics/?$', statistics.stats, name="stats"), - re_path(r'^stats/?$', statistics.stats, name="stats"), - re_path(r'^pathsreport.*$', statistics.pathsreport, name="pathsreport"), - re_path(r'^dataissues/?$', statistics.dataissues, name="dataissues"), + path('statistics', statistics.stats, name="stats"), + path('stats', statistics.stats, name="stats"), + path('pathsreport', statistics.pathsreport, name="pathsreport"), + path('dataissues', statistics.dataissues, name="dataissues"), - re_path(r'^troggle$', frontpage, name="frontpage"), # control panel. Shows recent actions. + re_path(r'^troggle$', frontpage, name="frontpage"), # control panel. Shows recent actions. re_path(r'^todo/(?P<module>.*)$', todos, name="todos"), - re_path(r'^controlpanel/?$', controlpanel, name="controlpanel"), + re_path(r'^controlpanel/?$', controlpanel, name="controlpanel"), # The survexfile pages - re_path(r'^survexfile/(?P<survex_file>.*?)\.svx$', survex.svx, name="svx"), - re_path(r'^survexfile/(?P<survex_file>.*?)\.3d$', survex.threed, name="threed"), - re_path(r'^survexfile/(?P<survex_file>.*?)\.log$', survex.svxraw), - re_path(r'^survexfile/(?P<survex_file>.*?)\.err$', survex.err), + path('survexfile/<path:survex_file>.svx', survex.svx, name="svx"), + path('survexfile/<path:survex_file>.3d', survex.threed, name="threed"), + path('survexfile/<path:survex_file>.log', survex.svxraw, name="svxraw"), + path('survexfile/<path:survex_file>.err', survex.err, name="err"), - re_path(r'^survexfile/caves/$', survex.survexcaveslist, name="survexcaveslist"), - re_path(r'^survexfile/caves$', survex.survexcaveslist, name="survexcaveslist"), # auto slash not working - re_path(r'^survexfile/(?P<survex_cave>.*)$', survex.survexcavesingle, name="survexcavessingle"), - re_path(r'^survey_scans/$', allwallets, name="allwallets"), - re_path(r'^survey_scans/(?P<path>[^/]+)/$', singlewallet, name="singlewallet"), - re_path(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$', - scansingle, name="scansingle"), + path('survexfile/caves', survex.survexcaveslist, name="survexcaveslist"), + path('survexfile/caves/', survex.survexcaveslist, name="survexcaveslist"), # auto slash not working + path('survexfile/<survex_cave>', survex.survexcavesingle, name="survexcavessingle"), + + path('survey_scans/', allwallets, name="allwallets"), + path('survey_scans/<path>/', singlewallet, name="singlewallet"), + path('survey_scans/<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 +# 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 @@ -176,7 +176,7 @@ trogglepatterns = [ re_path(r'^(.*)$', expopage, name="expopage"), # CATCHALL assumed relative to EXPOWEB ] -# do not allow DIR_ROOT prefix to all urls +# do NOT allow DIR_ROOT prefix to all urls urlpatterns = [ # re_path('^%s' % settings.DIR_ROOT, include(trogglepatterns)) re_path('', include(trogglepatterns))