Changing to new path() url function (initial)

This commit is contained in:
Philip Sargent 2021-04-27 19:02:11 +01:00
parent 942cbdd4b2
commit 821aaa1f66
2 changed files with 20 additions and 20 deletions

View File

@ -1,7 +1,7 @@
from django.conf import settings from django.conf import settings
from troggle.core.models.troggle import Expedition 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 in the processing of Django templates
This seems to mean that every page produced has bundled in its context the complete 'settings' and This seems to mean that every page produced has bundled in its context the complete 'settings' and

38
urls.py
View File

@ -121,36 +121,36 @@ trogglepatterns = [
re_path(r'^entrance/new/(?P<caveslug>[^/]+)$', caves.edit_entrance, name = "newentrance"), re_path(r'^entrance/new/(?P<caveslug>[^/]+)$', caves.edit_entrance, name = "newentrance"),
# System admin and monitoring # System admin and monitoring
re_path(r'^statistics/?$', statistics.stats, name="stats"), path('statistics', statistics.stats, name="stats"),
re_path(r'^stats/?$', statistics.stats, name="stats"), path('stats', statistics.stats, name="stats"),
re_path(r'^pathsreport.*$', statistics.pathsreport, name="pathsreport"), path('pathsreport', statistics.pathsreport, name="pathsreport"),
re_path(r'^dataissues/?$', statistics.dataissues, name="dataissues"), 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'^todo/(?P<module>.*)$', todos, name="todos"),
re_path(r'^controlpanel/?$', controlpanel, name="controlpanel"), re_path(r'^controlpanel/?$', controlpanel, name="controlpanel"),
# The survexfile pages # The survexfile pages
re_path(r'^survexfile/(?P<survex_file>.*?)\.svx$', survex.svx, name="svx"), path('survexfile/<path:survex_file>.svx', survex.svx, name="svx"),
re_path(r'^survexfile/(?P<survex_file>.*?)\.3d$', survex.threed, name="threed"), path('survexfile/<path:survex_file>.3d', survex.threed, name="threed"),
re_path(r'^survexfile/(?P<survex_file>.*?)\.log$', survex.svxraw), path('survexfile/<path:survex_file>.log', survex.svxraw, name="svxraw"),
re_path(r'^survexfile/(?P<survex_file>.*?)\.err$', survex.err), 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"), path('survexfile/caves', survex.survexcaveslist, name="survexcaveslist"),
re_path(r'^survey_scans/(?P<path>[^/]+)/$', singlewallet, name="singlewallet"), path('survexfile/caves/', survex.survexcaveslist, name="survexcaveslist"), # auto slash not working
re_path(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$', path('survexfile/<survex_cave>', survex.survexcavesingle, name="survexcavessingle"),
scansingle, name="scansingle"),
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 # The tunnel and therion drawings files pages
re_path(r'^dwgdata/$', dwgdata, name="dwgdata"), re_path(r'^dwgdata/$', dwgdata, name="dwgdata"),
re_path(r'^dwgdataraw/(?P<path>.+?\.xml)$', dwgfilesingle, name="dwgfilesingle"), 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>.+?\.th)$', dwgfilesingle, name="dwgfilesingle"),
re_path(r'^dwgdataraw/(?P<path>.+?\.th2)$', 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 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 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 = [ urlpatterns = [
# re_path('^%s' % settings.DIR_ROOT, include(trogglepatterns)) # re_path('^%s' % settings.DIR_ROOT, include(trogglepatterns))
re_path('', include(trogglepatterns)) re_path('', include(trogglepatterns))