summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2021-04-26 18:08:42 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2021-04-26 18:08:42 +0100
commit37403a7234a78ff10af4310b91e2258eef8bfb14 (patch)
treea2b469625c888a1bdcbf59b3f38e8e549108a431 /core
parentf0d291f527940cc3af8a0973a1fbb06cd1f949d7 (diff)
downloadtroggle-37403a7234a78ff10af4310b91e2258eef8bfb14.tar.gz
troggle-37403a7234a78ff10af4310b91e2258eef8bfb14.tar.bz2
troggle-37403a7234a78ff10af4310b91e2258eef8bfb14.zip
renamed tunnel to drawing or dwg
Diffstat (limited to 'core')
-rw-r--r--core/models/survex.py4
-rw-r--r--core/views/other.py2
-rw-r--r--core/views/surveys.py22
3 files changed, 14 insertions, 14 deletions
diff --git a/core/models/survex.py b/core/models/survex.py
index 94c6271..31f4646 100644
--- a/core/models/survex.py
+++ b/core/models/survex.py
@@ -199,13 +199,13 @@ class SingleScan(models.Model):
def __str__(self):
return "Survey Scan Image: " + str(self.name) + " in " + str(self.scansfolder)
-class TunnelFile(models.Model):
+class DrawingFile(models.Model):
tunnelpath = models.CharField(max_length=200)
tunnelname = models.CharField(max_length=200)
bfontcolours = models.BooleanField(default=False) # UNUSED now, can be deleted
manyscansfolders = models.ManyToManyField("ScansFolder") # implicitly links via folders to scans to SVX files
scans = models.ManyToManyField("SingleScan") # implicitly links via scans to SVX files
- tunnelcontains = models.ManyToManyField("TunnelFile") # case when its a frame type
+ tunnelcontains = models.ManyToManyField("DrawingFile") # case when its a frame type
filesize = models.IntegerField(default=0)
npaths = models.IntegerField(default=0)
survexfiles = models.ManyToManyField("SurvexFile") # direct link to SVX files - not populated yet
diff --git a/core/views/other.py b/core/views/other.py
index c864593..0f74657 100644
--- a/core/views/other.py
+++ b/core/views/other.py
@@ -92,7 +92,7 @@ def controlpanel(request):
import_surveyscans()
import_logbooks()
import_QMs()
- import_tunnelfiles()
+ import_dwgfiles()
import_survexblks()
import_survexpos()
else:
diff --git a/core/views/surveys.py b/core/views/surveys.py
index 3de395f..d149d4e 100644
--- a/core/views/surveys.py
+++ b/core/views/surveys.py
@@ -8,7 +8,7 @@ from django.conf import settings
from django.shortcuts import render
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, DrawingFile
from troggle.core.views.expo import getmimetype
import parsers.surveys
@@ -50,8 +50,8 @@ def scanswallets(request):
def dwgdata(request):
'''Report on all the drawing files in the system. These were loaded by parsing the entire directory tree
'''
- tunnelfiles = TunnelFile.objects.all()
- return render(request, 'dwgfiles.html', { 'tunnelfiles':tunnelfiles, 'settings': settings })
+ dwgfiles = DrawingFile.objects.all()
+ return render(request, 'dwgfiles.html', { 'dwgfiles':dwgfiles, 'settings': settings })
def dwgfilesingle(request, path):
@@ -59,12 +59,12 @@ def dwgfilesingle(request, path):
but it might be a Therion file
'''
try:
- tunnelfile = TunnelFile.objects.get(tunnelpath=urlunquote(path))
+ dwgfile = DrawingFile.objects.get(tunnelpath=urlunquote(path))
except:
message = f'Drawing file error or not found \'{path}\' .'
return render(request, 'errors/generic.html', {'message': message})
- tfile = Path(settings.TUNNEL_DATA, tunnelfile.tunnelpath)
+ tfile = Path(settings.TUNNEL_DATA, dwgfile.tunnelpath)
try: # for display not download
return HttpResponse(content=open(tfile, errors='strict'), content_type="text/xhtml")
except UnicodeDecodeError:
@@ -82,11 +82,11 @@ def dwgfileupload(request, path):
'''uploads a drawing file, but where is the Form? This just processes POST info. Apparently unfinished?
'''
try:
- tunnelfile = TunnelFile.objects.get(tunnelpath=urlunquote(path)) # need to check if inavlid query string and produce friendly error
+ dwgfile = DrawingFile.objects.get(tunnelpath=urlunquote(path)) # need to check if inavlid query string and produce friendly error
except:
message = f'Drawing file error or not found \'{path}\' .'
return render(request, 'errors/generic.html', {'message': message})
- tfile = Path(settings.TUNNEL_DATA, tunnelfile.tunnelpath)
+ tfile = Path(settings.TUNNEL_DATA, dwgfile.tunnelpath)
project, user, password, tunnelversion = request.POST["tunnelproject"], request.POST["tunneluser"], request.POST["tunnelpassword"], request.POST["tunnelversion"]
print(project, user, tunnelversion)
@@ -106,7 +106,7 @@ def dwgfileupload(request, path):
if os.path.split(path)[1] != uploadedfile.name:
return HttpResponse(content="Error: name disagrees", content_type="text/plain")
- orgsize = tunnelfile.filesize # = os.stat(tfile)[stat.ST_SIZE]
+ orgsize = dwgfile.filesize # = os.stat(tfile)[stat.ST_SIZE]
ttext = uploadedfile.read()
@@ -117,11 +117,11 @@ def dwgfileupload(request, path):
fout.close()
# redo its settings of
- parsers.surveys.SetTunnelfileInfo(tunnelfile)
- tunnelfile.save()
+ parsers.surveys.SetTunnelfileInfo(dwgfile) # commented out
+ dwgfile.save()
uploadedfile.close()
- message = "File size %d overwritten with size %d" % (orgsize, tunnelfile.filesize)
+ message = "File size %d overwritten with size %d" % (orgsize, dwgfile.filesize)
return HttpResponse(content=message, content_type="text/plain")