diff --git a/core/models/caves.py b/core/models/caves.py index 6f56cab..084bcdd 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -29,14 +29,14 @@ from troggle.core.models.survex import SurvexStation from troggle.core.utils import writetrogglefile from troggle.core.utils import TROG -# Use the TROG global object to cache the cave lookup list +# Use the TROG global object to cache the cave lookup list. No good for multi-user.. Gcavelookup = TROG['caves']['gcavelookup'] Gcave_count = TROG['caves']['gcavecount'] Gcavelookup = None Gcave_count = None -'''The model declarations for Areas, Caves and Entrances. Also LogBookENtry, QM, PersonTrip +'''The model declarations for Areas, Caves and Entrances. Also LogBookEntry, QM, PersonTrip ''' todo=''' @@ -166,30 +166,10 @@ class Cave(TroggleModel): return str(self.slug()) def get_QMs(self): - '''Searches for all QMs that reference this cave. Probably a better Django way to do this + '''Searches for all QMs that reference this cave. ''' qms = QM.objects.filter(cave=self).order_by('expoyear', 'block__date') # a QuerySet, see https://docs.djangoproject.com/en/4.0/ref/models/querysets/#order-by return qms # a QuerySet - # undated = [] - # dated = [] - # qms = QM.objects.filter(cave=self) # a QuerySet - # for q in qms: - # if q.block: - # dated.append(q) - # else: - # undated.append(q) - # sortedqms = sorted(dated, key=operator.attrgetter('block.date')) # sort by date of survexblock the QM was defined in - # orderedqms = sorted(undated, key=operator.attrgetter('expoyear')) # sort by date of expoyear - # return orderedqmcaves + sortedqms # a list, NOT a QuerySet - - - # def new_QM_number(self, year=datetime.date.today().year): - # """Given a cave and the current year, returns the next QM number.""" - # try: - # res=QM.objects.filter(found_by__date__year=year, found_by__cave_slug=self.slug).order_by('-number')[0] - # except IndexError: - # return 1 - # return res.number+1CaveAndEntrance def kat_area(self): for a in self.area.all(): diff --git a/parsers/survex.py b/parsers/survex.py index 27053cd..afd7e1d 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -69,7 +69,7 @@ class MapLocations(object): def points(self): for ent in Entrance.objects.all(): if ent.best_station(): - print(f"{ent.filename}", end=", ") + # print(f"{ent.filename}", end=", ") try: k = ent.caveandentrance_set.all()[0].cave except: diff --git a/templates/controlPanel.html b/templates/controlPanel.html index fc7f19c..6c97f9c 100644 --- a/templates/controlPanel.html +++ b/templates/controlPanel.html @@ -22,6 +22,7 @@

Administration Utilities