From 31b912f3cae63435da823e2910b5b83d25f41da4 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 22 Jul 2022 12:40:42 +0300 Subject: [PATCH] bugfixes --- core/models/caves.py | 8 ++++---- core/utils.py | 1 + parsers/scans.py | 4 ++-- templates/cave_qms.html | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/models/caves.py b/core/models/caves.py index 92255bb..3fae7f4 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -47,16 +47,16 @@ class Area(TroggleModel): super = models.ForeignKey('Area', blank=True, null=True, on_delete=models.SET_NULL) def __str__(self): - if self.parent: - return str(self.parent) + " - " + str(self.short_name) + if self.super: + return str(self.super) + " - " + str(self.short_name) else: return str(self.short_name) def kat_area(self): if self.short_name in ["1623", "1626", "1624", "1627"]: return self.short_name - elif self.parent: - return self.parent.kat_area() + elif self.super: + return self.super.kat_area() class CaveAndEntrance(models.Model): cave = models.ForeignKey('Cave',on_delete=models.CASCADE) diff --git a/core/utils.py b/core/utils.py index c9afdd5..9aa4679 100644 --- a/core/utils.py +++ b/core/utils.py @@ -69,6 +69,7 @@ def chaosmonkey(n): # def GetListDir(sdir): '''handles url or file, so we can refer to a set of scans (not drawings) on another server + returns a list of f (file), ff (file full path), is_dir (bool) ''' res = [ ] if type(sdir) is str and sdir[:7] == "http://": diff --git a/parsers/scans.py b/parsers/scans.py index 3d81f13..fdded82 100644 --- a/parsers/scans.py +++ b/parsers/scans.py @@ -105,7 +105,7 @@ def load_all_scans(): # do the year folders if re.match(r"\d\d\d\d$", walletname): print(f"{walletname}", end=' ') - for walletname, fpath, fisdir in GetListDir(ff): + for walletname, fpath, fisdir in GetListDir(fpath): if fisdir: wallet = Wallet(fpath=fpath, walletname=walletname) # this is where we should load the contents.json for people so we can report on them later @@ -116,7 +116,7 @@ def load_all_scans(): # what is this? elif walletname != "thumbs": - print(f'\n - Wallet {f} - {ff}') + print(f'\n - Wallet {walletname} - {fpath}') wallet = Wallet(fpath=fpath, walletname=walletname) wallet.save() LoadListScansFile(wallet) diff --git a/templates/cave_qms.html b/templates/cave_qms.html index a9cab3c..c1ae81f 100644 --- a/templates/cave_qms.html +++ b/templates/cave_qms.html @@ -2,7 +2,7 @@ {% load link %} {% block title %} QM: {{qm|safe}} {% endblock %} {% block contentheader %} -

Question marks for {{cave.kataster_number}} - {{cave.official_name|safe}} - {{cave.unofficial_number}}

+

Question marks for {{cave.kataster_number}} - {{cave.official_name|safe}} - {{cave.unofficial_number}}

Note that QMs loaded for 1623-161, 1623-204 and 1623-234 are imported from CSV files .