From b29ff618718f4d28ae4e5ae338ef0cf7dfb764b9 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Mon, 30 Jan 2023 16:18:19 +0000 Subject: Renaming class step 2 --- core/models/logbooks.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'core/models/logbooks.py') diff --git a/core/models/logbooks.py b/core/models/logbooks.py index 19cd33d..6070003 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -25,11 +25,10 @@ from troggle.core.models.survex import SurvexStation from troggle.core.models.troggle import (DataIssue, Expedition, Person, PersonExpedition, TroggleModel) -'''The model declarations LogBookEntry, PersonTrip, QM +'''The model declarations LogBookEntry, PersonLogEntry, QM ''' todo=''' -- Rename PersonTrip as PersonLogEntry or similar ''' class CaveSlug(models.Model): @@ -52,7 +51,7 @@ class LogbookEntry(TroggleModel): class Meta: verbose_name_plural = "Logbook Entries" - # several PersonTrips point in to this object + # several PersonLogEntrys point in to this object ordering = ('-date',) def cave(self): # Why didn't he just make this a foreign key to Cave ? @@ -91,7 +90,7 @@ class LogbookEntry(TroggleModel): return index -class PersonTrip(TroggleModel): +class PersonLogEntry(TroggleModel): """Single Person going on a trip, which may or may not be written up. It could account for different T/U for people in same logbook entry. """ @@ -105,14 +104,14 @@ class PersonTrip(TroggleModel): #order_with_respect_to = 'personexpedition' def next_personlog(self): - futurePTs = PersonTrip.objects.filter(personexpedition = self.personexpedition, logbook_entry__date__gt = self.logbook_entry.date).order_by('logbook_entry__date').all() + futurePTs = PersonLogEntry.objects.filter(personexpedition = self.personexpedition, logbook_entry__date__gt = self.logbook_entry.date).order_by('logbook_entry__date').all() if len(futurePTs) > 0: return futurePTs[0] else: return None def prev_personlog(self): - pastPTs = PersonTrip.objects.filter(personexpedition = self.personexpedition, logbook_entry__date__lt = self.logbook_entry.date).order_by('-logbook_entry__date').all() + pastPTs = PersonLogEntry.objects.filter(personexpedition = self.personexpedition, logbook_entry__date__lt = self.logbook_entry.date).order_by('-logbook_entry__date').all() if len(pastPTs) > 0: return pastPTs[0] else: -- cgit v1.2.3