forked from expo/troggle
rename surveyscansingle
This commit is contained in:
parent
9e11c0814e
commit
b8803c8e5b
@ -194,7 +194,7 @@ class SingleScan(models.Model):
|
||||
ordering = ('name',)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return urljoin(settings.URL_ROOT, reverse('surveyscansingle', kwargs={"path":re.sub("#", "%23", self.scansfolder.walletname), "file":self.name}))
|
||||
return urljoin(settings.URL_ROOT, reverse('scansingle', kwargs={"path":re.sub("#", "%23", self.scansfolder.walletname), "file":self.name}))
|
||||
|
||||
def __str__(self):
|
||||
return "Survey Scan Image: " + str(self.name) + " in " + str(self.scansfolder)
|
||||
|
@ -29,13 +29,13 @@ def surveyscansfolder(request, path):
|
||||
message = f'Scan folder error or not found \'{path}\' .'
|
||||
return render(request, 'errors/generic.html', {'message': message})
|
||||
|
||||
def surveyscansingle(request, path, file):
|
||||
def scansingle(request, path, file):
|
||||
'''sends a single binary file to the user for display - browser decides how using mimetype
|
||||
'''
|
||||
try:
|
||||
scansfolder = ScansFolder.objects.get(walletname=urlunquote(path))
|
||||
singlescan = SingleScan.objects.get(scansfolder=scansfolder, name=file)
|
||||
# print(" - surveyscansingle {}:{}:{}:".format(path, file, getmimetype(file)))
|
||||
# print(" - scansingle {}:{}:{}:".format(path, file, getmimetype(file)))
|
||||
return HttpResponse(content=open(singlescan.ffile,"rb"), content_type=getmimetype(file)) # any type of image
|
||||
except:
|
||||
message = f'Scan folder or scan item error or not found \'{path}\' and \'{file}\'.'
|
||||
|
4
urls.py
4
urls.py
@ -9,7 +9,7 @@ from django.contrib import auth
|
||||
from django.urls import reverse, resolve
|
||||
|
||||
from troggle.core.views import caves, statistics, survex
|
||||
from troggle.core.views.surveys import surveyscansingle, surveyscansfolder, surveyscansfolders, dwgdata, dwgfilesingle, dwgfileupload
|
||||
from troggle.core.views.surveys import scansingle, surveyscansfolder, surveyscansfolders, dwgdata, dwgfilesingle, dwgfileupload
|
||||
from troggle.core.views.other import troggle404, frontpage, todos, controlpanel, frontpage, scanupload
|
||||
from troggle.core.views.other import downloadlogbook, ajax_QM_number, downloadQMs
|
||||
from troggle.core.views.caves import ent, cavepage
|
||||
@ -144,7 +144,7 @@ trogglepatterns = [
|
||||
re_path(r'^survey_scans/$', surveyscansfolders, name="surveyscansfolders"),
|
||||
re_path(r'^survey_scans/(?P<path>[^/]+)/$', surveyscansfolder, name="surveyscansfolder"),
|
||||
re_path(r'^survey_scans/(?P<path>[^/]+)/(?P<file>[^/]+)$',
|
||||
surveyscansingle, name="surveyscansingle"),
|
||||
scansingle, name="scansingle"),
|
||||
|
||||
# The tunnel and therion drawings files pages
|
||||
re_path(r'^dwgdata/$', dwgdata, name="dwgdata"),
|
||||
|
Loading…
Reference in New Issue
Block a user