summaryrefslogtreecommitdiffstats
path: root/urls.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-04-16 21:28:44 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-04-16 21:28:44 +0100
commitfa1df39923d9ce5e1c134dec987c8665ce22c5de (patch)
treea4f8210ac15e768c68be4881ba15fa644c2bdfd3 /urls.py
parent49277216bafa0db559705943342e30b1a5934369 (diff)
downloadtroggle-fa1df39923d9ce5e1c134dec987c8665ce22c5de.tar.gz
troggle-fa1df39923d9ce5e1c134dec987c8665ce22c5de.tar.bz2
troggle-fa1df39923d9ce5e1c134dec987c8665ce22c5de.zip
stopo prospecting map crashing
Diffstat (limited to 'urls.py')
-rw-r--r--urls.py79
1 files changed, 43 insertions, 36 deletions
diff --git a/urls.py b/urls.py
index 5365d24..26eacbb 100644
--- a/urls.py
+++ b/urls.py
@@ -7,12 +7,16 @@ from django.contrib import admin
from django.contrib import auth
from django.urls import reverse, resolve
-from troggle.core.views import surveys, logbooks, other, caves, statistics, survex
+from troggle.core.views import surveys, other, caves, statistics, survex
from troggle.core.views.other import troggle404, frontpage
from troggle.core.views.caves import ent, cavepage
-from troggle.core.views.prospect import prospecting_image, prospecting
+from troggle.core.views.logbooks import get_logbook_entries, logbookentry, logbookSearch
+from troggle.core.views.logbooks import personindex, person, get_people
+from troggle.core.views.logbooks import expedition, personexpedition, Expeditions_tsvListView, Expeditions_jsonListView
+from troggle.core.views.prospect import prospecting_image
+from troggle.core.views.prospect import prospecting
from troggle.core.views.statistics import pathsreport, stats, dataissues
-from troggle.core.views.expo import expofiles_redirect, expofilessingle, expopage, editexpopage, mediapage
+from troggle.core.views.expo import expofiles_redirect, expofilessingle, expopage, editexpopage, mediapage, map, mapfile
from troggle.core.views.survex import survexcaveslist, survexcavesingle, svx
from troggle.core.views.auth import expologin, expologout
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
@@ -56,15 +60,15 @@ else:
# accounts/reset/done/ [name='password_reset_complete']
trogglepatterns = [
- url(r'^expofiles/', include(expofilesurls)),
+ url(r'^expofiles/', include(expofilesurls)),
url(r'^troggle$', other.frontpage, name="frontpage"), # control panel. Shows recent actions.
url(r'^caves$', caves.caveindex, name="caveindex"),
url(r'^indxal.htm$', caves.caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files
- url(r'^people/?$', logbooks.personindex, name="personindex"),
+ url(r'^people/?$', personindex, name="personindex"),
- url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/).
- url(r'^admin/', admin.site.urls), # includes admin login & logout urls
+ url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/).
+ url(r'^admin/', admin.site.urls), # includes admin login & logout urls
# setting LOGIN_URL = '/accounts/login/' is default
# url ENDS WITH this string
@@ -72,32 +76,36 @@ trogglepatterns = [
url(r'login/$', expologin, name='expologin'), # higher precedence than /accounts/login
#url(r'^accounts/', include('django.contrib.auth.urls')), # from Dj3.0, see site-packages\registration\auth_urls_classes.py
-
-# url(r'^person/(?P<person_id>\d*)/?$', logbooks.person),
- url(r'^person/(?P<first_name>[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P<last_name>[a-z\-\']*[^a-zA-Z]*[A-Z]*[a-z\-&;]*)/?', logbooks.person, name="person"),
+# Persons - nasty surname recognition logic fails for 19 people!
+# url(r'^person/(?P<person_id>\d*)/?$', person), makes Ruairidh MacLeod work but kills MacLean
# url(r'^person/(\w+_\w+)$', logbooks.person, name="person"),
+ url(r'^person/(?P<first_name>[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P<last_name>[a-z\-\']*[^a-zA-Z]*[A-Z]*[a-z\-&;]*)/?', person, name="person"),
+ url(r'^personexpedition/(?P<first_name>[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-zA-Z&;]*)/(?P<year>\d+)/?$', personexpedition, name="personexpedition"),
- url(r'^expedition/(\d+)$', logbooks.expedition, name="expedition"),
- url(r'^api/expeditions_tsv$', logbooks.Expeditions_tsvListView.as_view()),
- url(r'^api/expeditions_json$', logbooks.Expeditions_jsonListView.as_view()),
- url(r'^personexpedition/(?P<first_name>[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-zA-Z&;]*)/(?P<year>\d+)/?$', logbooks.personexpedition, name="personexpedition"),
+# Expedition master page
+ url(r'^expedition/(\d+)$', expedition, name="expedition"),
+ url(r'^api/expeditions_tsv$', Expeditions_tsvListView.as_view()),
+ url(r'^api/expeditions_json$', Expeditions_jsonListView.as_view()),
# Logbook entries
- url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', logbooks.logbookentry,name="logbookentry"),
- url(r'^getLogBookEntries/(?P<expeditionslug>.*)', logbooks.get_logbook_entries, name = "get_logbook_entries"), #works
+ url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', logbookentry,name="logbookentry"),
url(r'^newfile', other.newFile, name="newFile"), # oddly broken, needs investigating more
- url(r'^logbooksearch/(.*)/?$', logbooks.logbookSearch),
+ url(r'^logbooksearch/(.*)/?$', logbookSearch),
url(r'^logbook(?P<year>\d\d\d\d)\.(?P<extension>.*)/?$', other.downloadLogbook),
url(r'^logbook/?$', other.downloadLogbook, name="downloadlogbook"),
-
-
-# QMs pages
- url(r'^cave/qms/([^/]+)/?$', caves.caveQMs), # blank page
+
+# Internal. editfile.html template uses these internally
+ url(r'^getPeople/(?P<expeditionslug>.*)', get_people, name = "get_people"),
+ url(r'^getLogBookEntries/(?P<expeditionslug>.*)', get_logbook_entries, name = "get_logbook_entries"),
+ url(r'^getQMs/(?P<caveslug>.*)', caves.get_qms, name = "get_qms"),
+ url(r'^getEntrances/(?P<caveslug>.*)', caves.get_entrances, name = "get_entrances"),
+
+# QMs pages - must precede other /caves pages
+ url(r'^cave/qms/([^/]+)/?$', caves.caveQMs), # blank page usually
+ url(r'^cave/(?P<cave_id>[^/]+)/(?P<year>\d\d\d\d)-(?P<qm_id>\d*)(?P<grade>[ABCDX]?)?$', caves.qm, name="qm"),
url(r'^cave/(?P<cave_id>[^/]+)/qm\.csv/?$', other.downloadQMs, name="downloadqms"),
- url(r'^newqmnumber/?$', other.ajax_QM_number, ),
- url(r'^getQMs/(?P<caveslug>.*)', caves.get_qms, name = "get_qms"), # no template "get_qms"?
- url(r'^getPeople/(?P<expeditionslug>.*)', logbooks.get_people, name = "get_people"), # fails
- url(r'^downloadqms$', other.downloadQMs),
+ url(r'^newqmnumber/?$', other.ajax_QM_number, ), # blank page if no ch given
+# url(r'^downloadqms$', other.downloadQMs), # MultiValueDictKeyError
# Cave description pages
url(r'^cave/new/$', caves.edit_cave, name="newcave"),
@@ -105,14 +113,13 @@ trogglepatterns = [
url(r'^cave/(?P<cave_id>[^/]+)/?$', caves.cave, name="cave"),
url(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent), # view_caves.ent
url(r'^cave/(?P<slug>[^/]+)/edit/$', caves.edit_cave, name="edit_cave"),
- url(r'^cave/(?P<cave_id>[^/]+)/(?P<year>\d\d\d\d)-(?P<qm_id>\d*)(?P<grade>[ABCDX]?)?$', caves.qm, name="qm"),
- url(r'^cave/entrance/([^/]+)/?$', caves.caveEntrance),
+ url(r'^cave/entrance/([^/]+)/?$', caves.caveEntrance),
url(r'^cave/description/([^/]+)/?$', caves.caveDescription),
- url(r'^cave/logbook/([^/]+)/?$', caves.caveLogbook),
- url(r'^(?P<karea>\d\d\d\d)(?P<subpath>.*)$', cavepage, name="cavepage"), # shorthand references such as /1623/264
+ url(r'^cave/logbook/([^/]+)/?$', caves.caveLogbook),
+ url(r'^(?P<karea>162\d)(?P<subpath>.*)$', cavepage, name="cavepage"), # shorthand /1623/264 BUT url links may break
- url(r'^getEntrances/(?P<caveslug>.*)', caves.get_entrances, name = "get_entrances"), #works e.g. /getEntrances/1623-161 # CASE SENSITIVE
+# Entrances
url(r'^entrance/(?P<caveslug>[^/]+)/(?P<slug>[^/]+)/edit/', caves.editEntrance, name = "editentrance"),
url(r'^entrance/new/(?P<caveslug>[^/]+)/', caves.editEntrance, name = "newentrance"), # NOT WORKING
@@ -124,10 +131,6 @@ trogglepatterns = [
url(r'^controlpanel/?$', other.controlPanel, name="controlpanel"),
-
- url(r'^prospecting_guide/$', prospecting),
- url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
-
# The survexfile pages
url(r'^survexfile/(?P<survex_file>.*?)\.svx$', survex.svx, name="svx"),
url(r'^survexfile/(?P<survex_file>.*?)\.3d$', survex.threed, name="threed"),
@@ -151,14 +154,18 @@ trogglepatterns = [
# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', surveys.tunnelfileinfo, name="tunnelfileinfo"), # parses tunnel for info
url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$', surveys.tunnelfileupload, name="tunnelfileupload"),
+# Prospecting Guide document
+ url(r'^prospecting_guide/$', prospecting),
+ url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
+
# This next set are all intercepted by Apache, if it is running.
url(r'^photos/(?P<subpath>.*)$', mediapage, {'doc_root': settings.PHOTOS_ROOT}, name="mediapage"), # photo galleries
url(r'^site_media/(?P<subpath>.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # MEDIA_ROOT: CSS and JS
url(r'^static/(?P<subpath>.*)$', mediapage, {'doc_root': settings.MEDIA_ROOT}, name="mediapage"), # STATIC is in MEDIA now!
url(r'^javascript/(?P<subpath>.*)$', mediapage, {'doc_root': settings.JSLIB_ROOT}, name="mediapage"), # JSLIB_URL
url(r'^expowebcache/3d/(?P<subpath>.*)$', mediapage, {'doc_root': settings.THREEDCACHEDIR}, name="mediapage"),
-
-# url(r'^map/', .........), # Intercepted by Apache. Yields OpenStreetMap. Redirects to expoweb/map
+ url(r'^map/map.html', map, name="map"), # Redirects to OpenStreetMap JavaScript
+ url(r'^map/(?P<path>.*)$', mapfile, name="mapfile"), # css, js, gpx
# Final catchall which also serves expoweb handbook pages and images
url(r'^(.*)_edit$', editexpopage, name="editexpopage"),