mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
expopages now troggle/core/views_expo
This commit is contained in:
parent
b75baffdcf
commit
b3b2356a7e
@ -61,16 +61,16 @@ class SimpleTest(SimpleTestCase):
|
||||
def test_import_core_views_caves(self):
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
import troggle.core.views_expo
|
||||
from troggle.core.models import Expedition
|
||||
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.helper import login_required_if_public
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.conf import settings
|
||||
def test_import_parses_mix(self):
|
||||
def test_import_parsers_mix(self):
|
||||
from troggle.parsers.logbooks import GetCaveLookup
|
||||
import troggle.settings
|
||||
#import troggle.expopages.models
|
||||
import troggle.logbooksdump
|
||||
import troggle.parsers.caves
|
||||
import troggle.parsers.people
|
||||
|
@ -8,7 +8,6 @@ from django.core.management.base import BaseCommand, CommandError
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from troggle.core.models import Cave, Entrance
|
||||
import troggle.expopages.models
|
||||
|
||||
import settings
|
||||
|
||||
|
@ -9,7 +9,7 @@ from django.shortcuts import render
|
||||
from django.http import HttpResponse, Http404
|
||||
|
||||
from troggle.core.models_survex import ScansFolder, SingleScan, SurvexBlock, TunnelFile
|
||||
from troggle.expopages import views as flatviews
|
||||
from .views_expo import getmimetype
|
||||
import parsers.surveys
|
||||
|
||||
'''Some of these views serve files as binary blobs, and simply set the mime type based on the file extension,
|
||||
@ -30,8 +30,8 @@ def surveyscansingle(request, path, file):
|
||||
'''
|
||||
scansfolder = ScansFolder.objects.get(walletname=urlunquote(path)) # need to check if inavlid query string and produce friendly error
|
||||
singlescan = SingleScan.objects.get(scansfolder=scansfolder, name=file)
|
||||
# print(" - surveyscansingle {}:{}:{}:".format(path, file, flatviews.getmimetype(file)))
|
||||
return HttpResponse(content=open(singlescan.ffile,"rb"), content_type=flatviews.getmimetype(file)) # any type of image
|
||||
# print(" - surveyscansingle {}:{}:{}:".format(path, file, getmimetype(file)))
|
||||
return HttpResponse(content=open(singlescan.ffile,"rb"), content_type=getmimetype(file)) # any type of image
|
||||
|
||||
|
||||
def surveyscansfolders(request):
|
||||
|
@ -17,6 +17,11 @@ from troggle.core.models_caves import Cave
|
||||
import troggle.core.views_caves
|
||||
import troggle.settings as settings
|
||||
|
||||
'''Formerly a separate package 'flatpages' written by Martin Green 2011.
|
||||
This was NOT django.contrib.flatpages which stores HTML in the database, so the name was chnaged to expopages.
|
||||
Then it was incorporated into troggle directly, rather than being an unnecessary external package.
|
||||
'''
|
||||
|
||||
def expofiles_redirect(request, path):
|
||||
'''This is used only when running as a test system without a local copy of /expofiles/
|
||||
'''
|
@ -33,7 +33,6 @@ except:
|
||||
raise
|
||||
print(" - Memory footprint after loading Django: {:.3f} MB".format(resource.getrusage(resource.RUSAGE_SELF)[2]/1024.0))
|
||||
|
||||
import troggle.expopages.models
|
||||
import troggle.core.models
|
||||
import troggle.core.models_survex
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
#from troggle.expopages.models import Redirect, EntranceRedirect
|
||||
from django.contrib import admin
|
||||
|
||||
# admin.site.register(Redirect)
|
||||
# admin.site.register(EntranceRedirect)
|
@ -1,12 +0,0 @@
|
||||
from django.db import models
|
||||
from troggle.core.models_caves import Cave, Entrance
|
||||
|
||||
# class Redirect(models.Model):
|
||||
# originalURL = models.CharField(max_length=200, unique=True)
|
||||
# newURL = models.CharField(max_length=200)
|
||||
|
||||
# class EntranceRedirect(models.Model):
|
||||
# originalURL = models.CharField(max_length=200)
|
||||
# entrance = models.ForeignKey(Entrance,on_delete=models.CASCADE)
|
||||
# def __str__(self):
|
||||
# return self.entrance.slug
|
@ -19,7 +19,6 @@ from django.http import HttpResponse
|
||||
from django.urls import reverse
|
||||
|
||||
from troggle.core.models_caves import Cave, Entrance
|
||||
import troggle.expopages.models
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
def import_auto_logbooks():
|
||||
|
@ -123,7 +123,6 @@ INSTALLED_APPS = (
|
||||
# 'django.contrib.staticfiles', # Using workarounds with expopages
|
||||
'registration', # only for expo user. REPLACE using django.contrib.auth
|
||||
'troggle.core',
|
||||
'troggle.expopages', # Written by Martin Green 2011. This is NOT django.contrib.flatpages which stores HTML in the database
|
||||
)
|
||||
|
||||
# See the recommended order of these in https://docs.djangoproject.com/en/2.2/ref/middleware/
|
||||
|
14
urls.py
14
urls.py
@ -10,7 +10,7 @@ from troggle.core import views_other, views_caves, views_logbooks, views_statist
|
||||
from troggle.core.views_other import troggle404
|
||||
from troggle.core.views_caves import ent, prospecting_image
|
||||
from troggle.core.views_statistics import pathsreport, stats
|
||||
from expopages import views as flatviews
|
||||
from troggle.core.views_expo import expofiles_redirect, expofilessingle, flatpage, editflatpage
|
||||
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
|
||||
to resolve urls - in both directions as these are declarative.
|
||||
|
||||
@ -33,11 +33,11 @@ The API urls return TSV or JSON and are new in July 2020.
|
||||
|
||||
if settings.EXPOFILESREMOTE:
|
||||
expofilesurls = [
|
||||
url(r'^/*(?P<path>.*)$', flatviews.expofiles_redirect, name="expofiles_redirect"), # to expo.survex.com/expofiles
|
||||
url(r'^/*(?P<path>.*)$', expofiles_redirect, name="expofiles_redirect"), # to expo.survex.com/expofiles
|
||||
]
|
||||
else:
|
||||
expofilesurls = [
|
||||
url(r'^/*(?P<filepath>.*)$',flatviews.expofilessingle, name="single"), # local copy of EXPOFILES
|
||||
url(r'^/*(?P<filepath>.*)$', expofilessingle, name="single"), # local copy of EXPOFILES
|
||||
]
|
||||
|
||||
|
||||
@ -142,13 +142,13 @@ actualurlpatterns = [
|
||||
# {'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/.*)$', flatviews.flatpage, name="flatpage"), # MEDIA_ROOT: CSS and JS
|
||||
url(r'^(site_media/.*)$', flatpage, name="flatpage"), # MEDIA_ROOT: CSS and JS
|
||||
|
||||
# url(r'^static/(?P<filepath>.*)$', view_surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS
|
||||
url(r'^(static/.*)$', flatviews.flatpage, name="flatpage"), # STATIC: CSS and JS
|
||||
url(r'^(static/.*)$', flatpage, name="flatpage"), # STATIC: CSS and JS
|
||||
|
||||
url(r'^(.*)_edit$', flatviews.editflatpage, name="editflatpage"),
|
||||
url(r'^(.*)$', flatviews.flatpage, name="flatpage"), # CATCHALL assumed relative to EXPOWEB, some expofiles getting here..
|
||||
url(r'^(.*)_edit$', editflatpage, name="editflatpage"),
|
||||
url(r'^(.*)$', flatpage, name="flatpage"), # CATCHALL assumed relative to EXPOWEB, some expofiles getting here..
|
||||
]
|
||||
|
||||
#Allow DIR_ROOT prefix to all urls
|
||||
|
Loading…
Reference in New Issue
Block a user