diff --git a/core/models/survex.py b/core/models/survex.py index b4dadc9..207a47f 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -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 diff --git a/parsers/surveys.py b/parsers/surveys.py index 73161f2..a0cf520 100644 --- a/parsers/surveys.py +++ b/parsers/surveys.py @@ -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))