2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 06:17:07 +00:00

Fixing wiki-parsing for 2009 logbook

This commit is contained in:
2022-12-18 19:33:56 +00:00
parent 73b710d53f
commit d1b94763b4
5 changed files with 74 additions and 65 deletions

View File

@@ -453,10 +453,6 @@ class Entrance(TroggleModel):
class LogbookEntry(TroggleModel):
"""Single parsed entry from Logbook
But what is all this__getattribute__ meta stuff for ? When is it needed ?!?
Le'ts get rid of it and set the 'cave' attribute to a cave object elsehwhere. This is
attempting to be Too Clever.
"""
date = models.DateField()#MJG wants to turn this into a datetime such that multiple Logbook entries on the same day can be ordered.ld()
expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL)#MJG wants to KILL THIS (redundant information)
@@ -466,13 +462,14 @@ class LogbookEntry(TroggleModel):
place = models.CharField(max_length=100,blank=True, null=True,help_text="Only use this if you haven't chosen a cave")
text = models.TextField()
slug = models.SlugField(max_length=50)
time_underground = models.FloatField(null=True,help_text="In decimal hours")
class Meta:
verbose_name_plural = "Logbook Entries"
# several PersonTrips point in to this object
ordering = ('-date',)
def cave(self): # Why didn't he just make this a foreign key to Cave ? Replaces __getattrribute__ sillyness.
def cave(self): # Why didn't he just make this a foreign key to Cave ?
c = CaveSlug.objects.get(slug=self.cave_slug, primary=True).cave
return c
@@ -491,18 +488,6 @@ class LogbookEntry(TroggleModel):
def get_previous_by_id(self):
LogbookEntry.objects.get(id=self.id-1)
# def new_QM_number(self):
# """Returns """
# if self.cave:
# nextQMnumber=self.cave.new_QM_number(self.date.year)
# else:
# return None
# return nextQMnumber
# def new_QM_found_link(self):
# """Produces a link to a new QM with the next number filled in and this LogbookEntry set as 'found by' """
# return settings.URL_ROOT + r'/admin/core/qm/add/?' + r'found_by=' + str(self.pk) +'&number=' + str(self.new_QM_number())
def DayIndex(self):
return list(self.expeditionday.logbookentry_set.all()).index(self)