rename tunnelname as dwgname

This commit is contained in:
Philip Sargent 2021-04-26 18:37:59 +01:00
parent 0997fd0901
commit bd647b99ec
2 changed files with 7 additions and 7 deletions

View File

@ -201,7 +201,7 @@ class SingleScan(models.Model):
class DrawingFile(models.Model):
dwgpath = models.CharField(max_length=200)
tunnelname = models.CharField(max_length=200)
dwgname = models.CharField(max_length=200)
bfontcolours = models.BooleanField(default=False) # UNUSED now, can be deleted
manyscansfolders = models.ManyToManyField("Wallet") # implicitly links via folders to scans to SVX files
scans = models.ManyToManyField("SingleScan") # implicitly links via scans to SVX files

View File

@ -150,7 +150,7 @@ def find_tunnel_scan(dwgfile, path):
elif path and not re.search(r"\.(?:png|jpg|pdf|jpeg|gif|pdf)$(?i)", path):
name = os.path.split(path)[1]
rdwgfilel = DrawingFile.objects.filter(tunnelname=name)
rdwgfilel = DrawingFile.objects.filter(dwgname=name)
if len(rdwgfilel):
message = "! Two paths with same name [{}]: {}".format(path, name)
print(message)
@ -206,7 +206,7 @@ def settherionfileinfo(filetuple):
# scrap blownout -projection plan -scale [-81.0 -42.0 216.0 -42.0 0.0 0.0 7.5438 0.0 m]
for xth_me in rx_xth_me.findall(ttext):
message = f'! Un-parsed image filename: {therionfile.tunnelname} : {xth_me.split()[-3]} - {therionfile.dwgpath}'
message = f'! Un-parsed image filename: {therionfile.dwgname} : {xth_me.split()[-3]} - {therionfile.dwgpath}'
#print(message)
DataIssue.objects.create(parser='Therion', message=message)
findimageinsert(therionfile, xth_me)
@ -214,7 +214,7 @@ def settherionfileinfo(filetuple):
for inp in rx_input.findall(ttext):
# if this 'input' is a .th2 file we have already seen, then we can assign this as a sub-file
# but we would need to disentangle to get the current path properly
message = f'! Un-set Therion .th2 input: - {therionfile.tunnelname} : {inp} - {therionfile.dwgpath}'
message = f'! Un-set Therion .th2 input: - {therionfile.dwgname} : {inp} - {therionfile.dwgpath}'
#print(message)
DataIssue.objects.create(parser='Therion', message=message)
findimportinsert(therionfile, inp)
@ -278,17 +278,17 @@ def load_drawings_files():
drawingsdirs.append(lf) # lunatic! adding to list in middle of list while loop!
elif f[-4:] == ".xml":
# Always creates new
dwgfile = DrawingFile(dwgpath=lf, tunnelname=os.path.split(f[:-4])[1])
dwgfile = DrawingFile(dwgpath=lf, dwgname=os.path.split(f[:-4])[1])
dwgfile.save()
all_xml.append(('xml',dwgfile))
elif f[-3:] == ".th":
# Always creates new
dwgfile = DrawingFile(dwgpath=lf, tunnelname=os.path.split(f[:-4])[1])
dwgfile = DrawingFile(dwgpath=lf, dwgname=os.path.split(f[:-4])[1])
dwgfile.save()
all_xml.append(('th',dwgfile))
elif f[-4:] == ".th2":
# Always creates new
dwgfile = DrawingFile(dwgpath=lf, tunnelname=os.path.split(f[:-4])[1])
dwgfile = DrawingFile(dwgpath=lf, dwgname=os.path.split(f[:-4])[1])
dwgfile.save()
all_xml.append(('th2',dwgfile))