move *_views files to /views/*

This commit is contained in:
Philip Sargent 2021-03-31 21:51:17 +01:00
parent e1cf43c260
commit 7cccf4daf1
21 changed files with 85 additions and 100 deletions

View File

@ -40,7 +40,7 @@ class SimpleTest(SimpleTestCase):
import troggle.core.models_caves as models_caves import troggle.core.models_caves as models_caves
import troggle.core.models_survex as models_survex import troggle.core.models_survex as models_survex
from troggle.parsers.people import GetPersonExpeditionNameLookup from troggle.parsers.people import GetPersonExpeditionNameLookup
from troggle.core.views_caves import MapLocations from troggle.core.views.caves import MapLocations
def test_import_parsers_QMs(self): def test_import_parsers_QMs(self):
from troggle.core.models_caves import QM, Cave, LogbookEntry from troggle.core.models_caves import QM, Cave, LogbookEntry
from utils import save_carefully from utils import save_carefully
@ -56,7 +56,7 @@ class SimpleTest(SimpleTestCase):
def test_import_core_views_caves(self): def test_import_core_views_caves(self):
from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render from django.shortcuts import get_object_or_404, render
import troggle.core.views_expo import troggle.core.views.expo
from troggle.core.models import Expedition from troggle.core.models import Expedition
from troggle.core.models_caves import CaveSlug, Cave, CaveAndEntrance, QM, EntranceSlug, Entrance, Area, SurvexStation from troggle.core.models_caves import CaveSlug, Cave, CaveAndEntrance, QM, EntranceSlug, Entrance, Area, SurvexStation
from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm

View File

@ -4,7 +4,7 @@ from django.forms import ModelForm
from django.http import HttpResponse from django.http import HttpResponse
from django.core import serializers from django.core import serializers
from troggle.core.views_other import downloadLogbook from troggle.core.views.other import downloadLogbook
from troggle.core.models import Person, PersonExpedition, Expedition, DataIssue from troggle.core.models import Person, PersonExpedition, Expedition, DataIssue
from troggle.core.models_caves import Cave, Area, Entrance, CaveAndEntrance, LogbookEntry, PersonTrip, QM from troggle.core.models_caves import Cave, Area, Entrance, CaveAndEntrance, LogbookEntry, PersonTrip, QM
from troggle.core.models_survex import SurvexBlock, SurvexPersonRole, SurvexStation, ScansFolder, SingleScan from troggle.core.models_survex import SurvexBlock, SurvexPersonRole, SurvexStation, ScansFolder, SingleScan

View File

@ -156,7 +156,7 @@ def get_name(pe):
return pe.person.first_name return pe.person.first_name
class UploadFileForm(forms.Form): class UploadFileForm(forms.Form):
"""Only called by views_others.newFile() whhich seems to be only about logbook files. """Only called by views.others.newFile() whhich seems to be only about logbook files.
""" """
# Because this has EXECUTABLE statements in its signature (the fields) they get # Because this has EXECUTABLE statements in its signature (the fields) they get
# executed when this module is LOADED. Which barfs horribly. # executed when this module is LOADED. Which barfs horribly.

View File

@ -1,8 +0,0 @@
# primary namespace
from . import view_surveys
from . import views_caves
from . import views_survex
from . import views_logbooks
from . import views_other
from . import views_statistics

0
core/views/__init__.py Normal file
View File

View File

@ -15,7 +15,7 @@ import django.forms as forms
from troggle.helper import login_required_if_public from troggle.helper import login_required_if_public
from troggle.core.models_caves import Cave from troggle.core.models_caves import Cave
import troggle.core.views_caves import troggle.core.views.caves
import troggle.settings as settings import troggle.settings as settings
'''Formerly a separate package 'flatpages' written by Martin Green 2011. '''Formerly a separate package 'flatpages' written by Martin Green 2011.
@ -69,7 +69,7 @@ def expowebpage(request, expowebpath, path):
if m: if m:
preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups() preheader, headerattrs, head, postheader, bodyattrs, body, postbody = m.groups()
else: else:
return HttpResponse(html + "HTML Parsing failure: Page could not be split into header and body: failed in expowebpage in views_expo.py") return HttpResponse(html + "HTML Parsing failure: Page could not be split into header and body: failed in expowebpage in views.expo.py")
m = re.search(rb"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE) m = re.search(rb"<title>(.*)</title>", head, re.DOTALL + re.IGNORECASE)
if m: if m:
title, = m.groups() title, = m.groups()
@ -181,7 +181,7 @@ def getmimetype(path):
def editexpopage(request, path): def editexpopage(request, path):
try: try:
r = Cave.objects.get(url = path) r = Cave.objects.get(url = path)
return troggle.core.views_caves.editCave(request, r.cave.slug) return troggle.core.views.caves.editCave(request, r.cave.slug)
except Cave.DoesNotExist: except Cave.DoesNotExist:
pass pass

View File

@ -14,7 +14,7 @@ from troggle.core.models_caves import LogbookEntry, QM, Cave, PersonTrip
from troggle.helper import login_required_if_public from troggle.helper import login_required_if_public
from troggle.core.forms import UploadFileForm from troggle.core.forms import UploadFileForm
print("** importing troggle/core/views_other.py") print("** importing troggle/core/views.other.py")
"""Utility functions and code to serve the control panel and individual user's """Utility functions and code to serve the control panel and individual user's
progress and task list (deprecated as we do not have individual user login). progress and task list (deprecated as we do not have individual user login).
@ -140,7 +140,7 @@ def ajax_QM_number(request):
return HttpResponse(res) return HttpResponse(res)
print(" - newFile() is next in troggle/core/views_other.py") print(" - newFile() is next in troggle/core/views.other.py")
@login_required_if_public @login_required_if_public
def newFile(request, pslug = None): def newFile(request, pslug = None):
@ -194,4 +194,4 @@ def delFile(f):
lbe.delete() lbe.delete()
os.remove(lbe.filename) os.remove(lbe.filename)
print("** Finished importing troggle/core/views_other.py") print("** Finished importing troggle/core/views.other.py")

View File

@ -9,7 +9,7 @@ from django.shortcuts import render
from django.http import HttpResponse, Http404 from django.http import HttpResponse, Http404
from troggle.core.models_survex import ScansFolder, SingleScan, SurvexBlock, TunnelFile from troggle.core.models_survex import ScansFolder, SingleScan, SurvexBlock, TunnelFile
from .views_expo import getmimetype from troggle.core.views.expo import getmimetype
import parsers.surveys import parsers.surveys
'''Some of these views serve files as binary blobs, and simply set the mime type based on the file extension, '''Some of these views serve files as binary blobs, and simply set the mime type based on the file extension,

View File

@ -96,16 +96,12 @@ def reinit_db():
if django.db.connections.databases['default']['ENGINE'] == 'django.db.backends.sqlite3': if django.db.connections.databases['default']['ENGINE'] == 'django.db.backends.sqlite3':
with transaction.atomic(): with transaction.atomic():
management.call_command('makemigrations','core', interactive=False) management.call_command('makemigrations','core', interactive=False)
management.call_command('makemigrations','expopages', interactive=False)
management.call_command('migrate', interactive=False) management.call_command('migrate', interactive=False)
management.call_command('migrate','core', interactive=False) management.call_command('migrate','core', interactive=False)
management.call_command('migrate','expopages', interactive=False)
else: else:
management.call_command('makemigrations','core', interactive=False) management.call_command('makemigrations','core', interactive=False)
management.call_command('makemigrations','expopages', interactive=False)
management.call_command('migrate', interactive=False) management.call_command('migrate', interactive=False)
management.call_command('migrate','core', interactive=False) management.call_command('migrate','core', interactive=False)
management.call_command('migrate','expopages', interactive=False)
print(" - done migration on: " + settings.DATABASES['default']['NAME']) print(" - done migration on: " + settings.DATABASES['default']['NAME'])

View File

@ -58,7 +58,7 @@ SVX_URL = urllib.parse.urljoin(URL_ROOT , '/survex/')
STATIC_URL = urllib.parse.urljoin(URL_ROOT , '/static/') # used by Django admin pages. Do not delete. STATIC_URL = urllib.parse.urljoin(URL_ROOT , '/static/') # used by Django admin pages. Do not delete.
JSLIB_URL = urllib.parse.urljoin(URL_ROOT , '/javascript/') # always fails, try to revive it ? JSLIB_URL = urllib.parse.urljoin(URL_ROOT , '/javascript/') # always fails, try to revive it ?
#STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views_surveys.py #STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views/surveys.py
# --------------------- MEDIA redirections END --------------------- # --------------------- MEDIA redirections END ---------------------
PUBLIC_SITE = True PUBLIC_SITE = True

View File

@ -60,7 +60,7 @@ print(TROGGLE_PATH)
print(TEMPLATE_PATH) print(TEMPLATE_PATH)
print(MEDIA_ROOT) print(MEDIA_ROOT)
#STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views_surveys.py #STATIC_ROOT removed after merging content into MEDIA_ROOT. See urls.py & core/views/surveys.py
# --------------------- MEDIA redirections END --------------------- # --------------------- MEDIA redirections END ---------------------
PUBLIC_SITE = True PUBLIC_SITE = True

View File

@ -97,7 +97,7 @@ SURVEYS_URL = '/survey_scans/'
EXPOFILES = urllib.parse.urljoin(REPOS_ROOT_PATH, 'expofiles/') EXPOFILES = urllib.parse.urljoin(REPOS_ROOT_PATH, 'expofiles/')
PHOTOS_URL = urllib.parse.urljoin(URL_ROOT, '/photos/') PHOTOS_URL = urllib.parse.urljoin(URL_ROOT, '/photos/')
# MEDIA_URL is used by urls.py in a regex. See urls.py & core/views_surveys.py # MEDIA_URL is used by urls.py in a regex. See urls.py & core/views/surveys.py
MEDIA_URL = '/site_media/' MEDIA_URL = '/site_media/'
MEDIA_ROOT = REPOS_ROOT_PATH + '/troggle/media/' MEDIA_ROOT = REPOS_ROOT_PATH + '/troggle/media/'

View File

@ -18,7 +18,7 @@ import troggle.core.models_survex as models_survex
from troggle.utils import ChaosMonkey from troggle.utils import ChaosMonkey
from troggle.parsers.people import GetPersonExpeditionNameLookup from troggle.parsers.people import GetPersonExpeditionNameLookup
from troggle.parsers.logbooks import GetCaveLookup from troggle.parsers.logbooks import GetCaveLookup
from troggle.core.views_caves import MapLocations from troggle.core.views.caves import MapLocations
survexblockroot = None survexblockroot = None
ROOTBLOCK = "rootblock" ROOTBLOCK = "rootblock"
@ -61,7 +61,7 @@ class LoadingSurvex():
rx_teammem = re.compile(r"(?i)"+instruments+"?(?:es|s)?\s+(.*)"+instruments+"?(?:es|s)?$") rx_teammem = re.compile(r"(?i)"+instruments+"?(?:es|s)?\s+(.*)"+instruments+"?(?:es|s)?$")
rx_person = re.compile(r"(?i) and | / |, | & | \+ |^both$|^none$") rx_person = re.compile(r"(?i) and | / |, | & | \+ |^both$|^none$")
rx_qm = re.compile(r'(?i)^\s*QM(\d)\s+?([a-dA-DxX])\s+([\w\-]+)\.(\d+)\s+(([\w\-]+)\.(\d+)|\-)\s+(.+)$') rx_qm = re.compile(r'(?i)^\s*QM(\d)\s+?([a-dA-DxX])\s+([\w\-]+)\.(\d+)\s+(([\w\-]+)\.(\d+)|\-)\s+(.+)$')
# remember there is also QM_PATTERN used in views_other and set in settings.py # remember there is also QM_PATTERN used in views.other and set in settings.py
rx_tapelng = re.compile(r'(?i).*(tape|length).*$') rx_tapelng = re.compile(r'(?i).*(tape|length).*$')
rx_cave = re.compile(r'(?i)caves-(\d\d\d\d)/([-\d\w]+|\d\d\d\d-?\w+-\d+)') rx_cave = re.compile(r'(?i)caves-(\d\d\d\d)/([-\d\w]+|\d\d\d\d-?\w+-\d+)')

View File

@ -1,14 +1,10 @@
System check identified some issues: System check identified some issues:
WARNINGS: WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems. ?: (security.W001) You do not have 'django.middleware.security.SecurityMiddleware' in your MIDDLEWARE_CLASSES so the SECURE_HSTS_SECONDS, SECURE_CONTENT_TYPE_NOSNIFF, SECURE_BROWSER_XSS_FILTER, and SECURE_SSL_REDIRECT settings will have no effect.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SSL connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W012) SESSION_COOKIE_SECURE is not set to True. Using a secure-only session cookie makes it more difficult for network traffic sniffers to hijack user sessions. ?: (security.W012) SESSION_COOKIE_SECURE is not set to True. Using a secure-only session cookie makes it more difficult for network traffic sniffers to hijack user sessions.
?: (security.W016) You have 'django.middleware.csrf.CsrfViewMiddleware' in your MIDDLEWARE_CLASSES, but you have not set CSRF_COOKIE_SECURE to True. Using a secure-only CSRF cookie makes it more difficult for network traffic sniffers to steal the CSRF token.
?: (security.W018) You should not have DEBUG set to True in deployment. ?: (security.W018) You should not have DEBUG set to True in deployment.
?: (security.W019) You have 'django.middleware.clickjacking.XFrameOptionsMiddleware' in your MIDDLEWARE_CLASSES, but X_FRAME_OPTIONS is not set to 'DENY'. The default is 'SAMEORIGIN', but unless there is a good reason for your site to serve other parts of itself in a frame, you should change it to 'DENY'. ?: (security.W019) You have 'django.middleware.clickjacking.XFrameOptionsMiddleware' in your MIDDLEWARE_CLASSES, but X_FRAME_OPTIONS is not set to 'DENY'. The default is 'SAMEORIGIN', but unless there is a good reason for your site to serve other parts of itself in a frame, you should change it to 'DENY'.
System check identified 5 issues (0 silenced). System check identified 5 issues (0 silenced).

View File

@ -66,7 +66,7 @@ it duplicates the entry but gets it wrong. The length from the first block is di
- The template is in <var>troggle/templates/personexpedition.html</var> - The template is in <var>troggle/templates/personexpedition.html</var>
<br> <br>
- The code is in function <var>personexpedition()</var> which calls - The code is in function <var>personexpedition()</var> which calls
<var>GetPersonChronology()</var> in <var>troggle/core/views_logbooks.py</var> <var>GetPersonChronology()</var> in <var>troggle/core/views/logbooks.py</var>
<br> <br>
- the connection between the two is made in the URL resolver in <var>troggle/urls.py</var> - the connection between the two is made in the URL resolver in <var>troggle/urls.py</var>
<p>To be fixed! <p>To be fixed!

131
urls.py
View File

@ -6,11 +6,12 @@ from django.views.generic.list import ListView
from django.contrib import admin from django.contrib import admin
from django.urls import reverse, resolve from django.urls import reverse, resolve
from troggle.core import views_other, views_caves, views_logbooks, views_statistics, views_survex, view_surveys from troggle.core.views import surveys, logbooks, other, caves, statistics, survex
from troggle.core.views_other import troggle404 from troggle.core.views.other import troggle404, frontpage
from troggle.core.views_caves import ent, prospecting_image from troggle.core.views.caves import ent, prospecting_image
from troggle.core.views_statistics import pathsreport, stats from troggle.core.views.statistics import pathsreport, stats
from troggle.core.views_expo import expofiles_redirect, expofilessingle, expopage, editexpopage from troggle.core.views.expo import expofiles_redirect, expofilessingle, expopage, editexpopage
from troggle.core.views.survex import survexcaveslist, survexcavesingle, svx
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses """This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
to resolve urls - in both directions as these are declarative. to resolve urls - in both directions as these are declarative.
@ -25,7 +26,7 @@ which is vital to writing code for the webapp. So the URL dispatch is declarativ
The API urls return TSV or JSON and are new in July 2020. The API urls return TSV or JSON and are new in July 2020.
""" """
#handler404 = 'troggle.core.views_other.troggle404' # can't get this to work. but 404.html is default anyway #handler404 = 'troggle.core.views.other.troggle404' # can't get this to work. but 404.html is default anyway
# Many of these patterns do not work because troggle spent many years broken and we have # Many of these patterns do not work because troggle spent many years broken and we have
# not yet restored all the functions. Some may have never been fully implemented in # not yet restored all the functions. Some may have never been fully implemented in
@ -44,10 +45,10 @@ else:
trogglepatterns = [ trogglepatterns = [
url(r'^expofiles/', include(expofilesurls)), url(r'^expofiles/', include(expofilesurls)),
url(r'^troggle$', views_other.frontpage, name="frontpage"), # control panel. Shows recent actions. url(r'^troggle$', other.frontpage, name="frontpage"), # control panel. Shows recent actions.
url(r'^caves$', views_caves.caveindex, name="caveindex"), url(r'^caves$', caves.caveindex, name="caveindex"),
url(r'^indxal.htm$', views_caves.caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files url(r'^indxal.htm$', caves.caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files
url(r'^people/?$', views_logbooks.personindex, name="personindex"), url(r'^people/?$', logbooks.personindex, name="personindex"),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/). url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/).
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
@ -58,82 +59,82 @@ trogglepatterns = [
url(r'^accounts/', include('django.contrib.auth.urls')), # from Dj3.0, see site-packages\registration\auth_urls_classes.py url(r'^accounts/', include('django.contrib.auth.urls')), # from Dj3.0, see site-packages\registration\auth_urls_classes.py
url(r'^newqmnumber/?$', views_other.ajax_QM_number, ), url(r'^newqmnumber/?$', other.ajax_QM_number, ),
# url(r'^lbo_suggestions/?$', logbook_entry_suggestions), #broken, removed. # url(r'^lbo_suggestions/?$', logbook_entry_suggestions), #broken, removed.
# url(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person), # 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\-&;]*)/?', views_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\-&;]*)/?', logbooks.person, name="person"),
# url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"), # url(r'^person/(\w+_\w+)$', logbooks.person, name="person"),
# url(r'^personform/(.*)$', personForm), # url(r'^personform/(.*)$', personForm),
url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"), url(r'^expedition/(\d+)$', logbooks.expedition, name="expedition"),
url(r'^api/expeditions_tsv$', views_logbooks.Expeditions_tsvListView.as_view()), url(r'^api/expeditions_tsv$', logbooks.Expeditions_tsvListView.as_view()),
url(r'^api/expeditions_json$', views_logbooks.Expeditions_jsonListView.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+)/?$', views_logbooks.personexpedition, name="personexpedition"), 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"),
url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', views_logbooks.logbookentry,name="logbookentry"), url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', logbooks.logbookentry,name="logbookentry"),
# url(r'^newlogbookentry/(?P<expeditionyear>.*)$', views_logbooks.newLogbookEntry, name="newLogBookEntry"), # Needed ! # url(r'^newlogbookentry/(?P<expeditionyear>.*)$', logbooks.newLogbookEntry, name="newLogBookEntry"), # Needed !
# url(r'^editlogbookentry/(?P<expeditionyear>[^/]*)/(?P<pdate>[^/]*)/(?P<pslug>[^/]*)/$', views_logbooks.newLogbookEntry, name="editLogBookEntry"), # working ! # url(r'^editlogbookentry/(?P<expeditionyear>[^/]*)/(?P<pdate>[^/]*)/(?P<pslug>[^/]*)/$', logbooks.newLogbookEntry, name="editLogBookEntry"), # working !
# url(r'^deletelogbookentry/(?P<expeditionyear>[^/]*)/(?P<date>[^/]*)/(?P<slug>[^/]*)/$', views_logbooks.deleteLogbookEntry, name="deleteLogBookEntry"), # url(r'^deletelogbookentry/(?P<expeditionyear>[^/]*)/(?P<date>[^/]*)/(?P<slug>[^/]*)/$', logbooks.deleteLogbookEntry, name="deleteLogBookEntry"),
url(r'^newfile', views_other.newFile, name="newFile"), # oddly broken, needs investigating more url(r'^newfile', other.newFile, name="newFile"), # oddly broken, needs investigating more
url(r'^getEntrances/(?P<caveslug>.*)', views_caves.get_entrances, name = "get_entrances"), #works url(r'^getEntrances/(?P<caveslug>.*)', caves.get_entrances, name = "get_entrances"), #works
# e.g. /getEntrances/1623-161 # e.g. /getEntrances/1623-161
url(r'^getQMs/(?P<caveslug>.*)', views_caves.get_qms, name = "get_qms"), # no template "get_qms"? url(r'^getQMs/(?P<caveslug>.*)', caves.get_qms, name = "get_qms"), # no template "get_qms"?
url(r'^getPeople/(?P<expeditionslug>.*)', views_logbooks.get_people, name = "get_people"), # fails url(r'^getPeople/(?P<expeditionslug>.*)', logbooks.get_people, name = "get_people"), # fails
url(r'^getLogBookEntries/(?P<expeditionslug>.*)', views_logbooks.get_logbook_entries, name = "get_logbook_entries"), #works url(r'^getLogBookEntries/(?P<expeditionslug>.*)', logbooks.get_logbook_entries, name = "get_logbook_entries"), #works
url(r'^cave/new/$', views_caves.edit_cave, name="newcave"), url(r'^cave/new/$', caves.edit_cave, name="newcave"),
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cave, name="cave"), 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<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent), # view_caves.ent
url(r'^cave/(?P<slug>[^/]+)/edit/$', views_caves.edit_cave, name="edit_cave"), 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]?)?$', views_caves.qm, name="qm"), 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'^caveslug/([^/]+)/?$', views_caves.caveSlug, name="caveSlug"), url(r'^caveslug/([^/]+)/?$', caves.caveSlug, name="caveSlug"),
url(r'^cave/entrance/([^/]+)/?$', views_caves.caveEntrance), url(r'^cave/entrance/([^/]+)/?$', caves.caveEntrance),
url(r'^cave/description/([^/]+)/?$', views_caves.caveDescription), url(r'^cave/description/([^/]+)/?$', caves.caveDescription),
url(r'^cave/qms/([^/]+)/?$', views_caves.caveQMs), # blank page url(r'^cave/qms/([^/]+)/?$', caves.caveQMs), # blank page
url(r'^cave/logbook/([^/]+)/?$', views_caves.caveLogbook), url(r'^cave/logbook/([^/]+)/?$', caves.caveLogbook),
url(r'^cave/3d/(?P<cave_id>[^/]+).3d$', views_caves.cave3d, name="cave3d"), url(r'^cave/3d/(?P<cave_id>[^/]+).3d$', caves.cave3d, name="cave3d"),
url(r'^entrance/(?P<caveslug>[^/]+)/(?P<slug>[^/]+)/edit/', views_caves.editEntrance, name = "editentrance"), url(r'^entrance/(?P<caveslug>[^/]+)/(?P<slug>[^/]+)/edit/', caves.editEntrance, name = "editentrance"),
url(r'^entrance/new/(?P<caveslug>[^/]+)/', views_caves.editEntrance, name = "newentrance"), url(r'^entrance/new/(?P<caveslug>[^/]+)/', caves.editEntrance, name = "newentrance"),
url(r'^prospecting_guide/$', views_caves.prospecting), url(r'^prospecting_guide/$', caves.prospecting),
url(r'^logbooksearch/(.*)/?$', views_logbooks.logbookSearch), url(r'^logbooksearch/(.*)/?$', logbooks.logbookSearch),
url(r'^statistics/?$', views_statistics.stats, name="stats"), url(r'^statistics/?$', statistics.stats, name="stats"),
url(r'^stats/?$', views_statistics.stats, name="stats"), url(r'^stats/?$', statistics.stats, name="stats"),
url(r'^pathsreport.*$', views_statistics.pathsreport, name="pathsreport"), url(r'^pathsreport.*$', statistics.pathsreport, name="pathsreport"),
url(r'^controlpanel/?$', views_other.controlPanel, name="controlpanel"), url(r'^controlpanel/?$', other.controlPanel, name="controlpanel"),
url(r'^logbook(?P<year>\d\d\d\d)\.(?P<extension>.*)/?$',views_other.downloadLogbook), url(r'^logbook(?P<year>\d\d\d\d)\.(?P<extension>.*)/?$', other.downloadLogbook),
url(r'^logbook/?$',views_other.downloadLogbook, name="downloadlogbook"), url(r'^logbook/?$', other.downloadLogbook, name="downloadlogbook"),
url(r'^cave/(?P<cave_id>[^/]+)/qm\.csv/?$', views_other.downloadQMs, name="downloadqms"), url(r'^cave/(?P<cave_id>[^/]+)/qm\.csv/?$', other.downloadQMs, name="downloadqms"),
url(r'^downloadqms$', views_other.downloadQMs), url(r'^downloadqms$', other.downloadQMs),
# url(r'^map/', .........), # Intercepted by Apache. Yields OpenStreetMap. Redirects to expoweb/map # url(r'^map/', .........), # Intercepted by Apache. Yields OpenStreetMap. Redirects to expoweb/map
url(r'^survexfile/(?P<survex_file>.*?)\.svx$', views_survex.svx, name="svx"), url(r'^survexfile/(?P<survex_file>.*?)\.svx$', survex.svx, name="svx"),
url(r'^survexfile/(?P<survex_file>.*?)\.3d$', views_survex.threed, name="threed"), url(r'^survexfile/(?P<survex_file>.*?)\.3d$', survex.threed, name="threed"),
url(r'^survexfile/(?P<survex_file>.*?)\.log$', views_survex.svxraw), url(r'^survexfile/(?P<survex_file>.*?)\.log$', survex.svxraw),
url(r'^survexfile/(?P<survex_file>.*?)\.err$', views_survex.err), url(r'^survexfile/(?P<survex_file>.*?)\.err$', survex.err),
url(r'^survexfile/caves/$', views_survex.survexcaveslist, name="survexcaveslist"), url(r'^survexfile/caves/$', survex.survexcaveslist, name="survexcaveslist"),
url(r'^survexfile/(?P<survex_cave>.*)$', views_survex.survexcavesingle, name="survexcavessingle"), url(r'^survexfile/(?P<survex_cave>.*)$', survex.survexcavesingle, name="survexcavessingle"),
url(r'^survey_scans/$', view_surveys.surveyscansfolders, name="surveyscansfolders"), url(r'^survey_scans/$', surveys.surveyscansfolders, name="surveyscansfolders"),
url(r'^survey_scans/(?P<path>[^/]+)/$', view_surveys.surveyscansfolder, name="surveyscansfolder"), url(r'^survey_scans/(?P<path>[^/]+)/$', surveys.surveyscansfolder, name="surveyscansfolder"),
url(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$', url(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$',
view_surveys.surveyscansingle, name="surveyscansingle"), surveys.surveyscansingle, name="surveyscansingle"),
url(r'^tunneldata/$', view_surveys.tunneldata, name="tunneldata"), url(r'^tunneldata/$', surveys.tunneldata, name="tunneldata"),
url(r'^tunneldataraw/(?P<path>.+?\.xml)$', view_surveys.tunnelfilesingle, name="tunnelfile"), url(r'^tunneldataraw/(?P<path>.+?\.xml)$', surveys.tunnelfilesingle, name="tunnelfile"),
# url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', view_surveys.tunnelfileinfo, name="tunnelfileinfo"), # url(r'^tunneldatainfo/(?P<path>.+?\.xml)$', surveys.tunnelfileinfo, name="tunnelfileinfo"),
url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$', view_surveys.tunnelfileupload, name="tunnelfileupload"), url(r'^tunneldataraw/(?P<path>.+?\.xml)/upload$', surveys.tunnelfileupload, name="tunnelfileupload"),
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"), url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
# url(r'^javascript/(?P<filepath>.*)$', view_surveys.expofilessingle, name="single"), # JSLIB_URL - Apache: Alias /javascript /usr/share/javascript # url(r'^javascript/(?P<filepath>.*)$', surveys.expofilessingle, name="single"), # JSLIB_URL - Apache: Alias /javascript /usr/share/javascript
# static views not working, removed as a plugin. Use apache instead to serve these: # static views not working, removed as a plugin. Use apache instead to serve these:
# url(r'^photos/(?P<path>.*)$', staticviews.serve, # url(r'^photos/(?P<path>.*)$', staticviews.serve,
@ -141,10 +142,10 @@ trogglepatterns = [
# url(r'^gallery/(?P<path>.*)$', staticviews.serve, # url(r'^gallery/(?P<path>.*)$', staticviews.serve,
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), # {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
# url(r'^site_media/(?P<filepath>.*)$', view_surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS # url(r'^site_media/(?P<filepath>.*)$', surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS
url(r'^(site_media/.*)$', expopage, name="expopage"), # MEDIA_ROOT: CSS and JS url(r'^(site_media/.*)$', expopage, name="expopage"), # MEDIA_ROOT: CSS and JS
# url(r'^static/(?P<filepath>.*)$', view_surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS # url(r'^static/(?P<filepath>.*)$', surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS
url(r'^(static/.*)$', expopage, name="expopage"), # STATIC: CSS and JS url(r'^(static/.*)$', expopage, name="expopage"), # STATIC: CSS and JS
url(r'^(.*)_edit$', editexpopage, name="editexpopage"), url(r'^(.*)_edit$', editexpopage, name="editexpopage"),