diff options
Diffstat (limited to 'core/models')
-rw-r--r-- | core/models/caves.py | 2 | ||||
-rw-r--r-- | core/models/logbooks.py | 11 | ||||
-rw-r--r-- | core/models/survex.py | 1 | ||||
-rw-r--r-- | core/models/troggle.py | 5 |
4 files changed, 6 insertions, 13 deletions
diff --git a/core/models/caves.py b/core/models/caves.py index b99140b..921a5a4 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -34,7 +34,7 @@ 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 ''' todo=''' 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: diff --git a/core/models/survex.py b/core/models/survex.py index 24b679a..e23cd74 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -162,7 +162,6 @@ class SurvexPersonRole(models.Model): personname = models.CharField(max_length=100) person = models.ForeignKey('Person', blank=True, null=True,on_delete=models.SET_NULL) personexpedition = models.ForeignKey('PersonExpedition', blank=True, null=True,on_delete=models.SET_NULL) - # persontrip = models.ForeignKey('PersonTrip', blank=True, null=True,on_delete=models.SET_NULL) # logbook thing not a survex thing expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL) def __str__(self): diff --git a/core/models/troggle.py b/core/models/troggle.py index 6e470b3..a061ee5 100644 --- a/core/models/troggle.py +++ b/core/models/troggle.py @@ -93,11 +93,6 @@ class ExpeditionDay(TroggleModel): class Meta: ordering = ('date',) - # def GetPersonTrip(self, personexpedition): - # """returns all logbook trips for this expeditonday - # """ - # personexpeditions = self.persontrip_set.filter(expeditionday=self) - # return personexpeditions and personexpeditions[0] or None class Person(TroggleModel): """single Person, can go on many years |