forked from expo/troggle
Fixed coloured T and S on expo calendar
This commit is contained in:
@@ -21,6 +21,7 @@ from django.template import Context, loader
|
||||
from django.urls import reverse
|
||||
|
||||
import settings
|
||||
#from troggle.core.models.caves import CaveSlug
|
||||
from troggle.core.models.survex import SurvexStation
|
||||
from troggle.core.models.troggle import (DataIssue, Expedition, Person,
|
||||
PersonExpedition, TroggleModel)
|
||||
@@ -36,7 +37,7 @@ class LogbookEntry(TroggleModel):
|
||||
"""Single parsed entry from Logbook
|
||||
"""
|
||||
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)
|
||||
# expeditionday = models.ForeignKey("ExpeditionDay", null=True,on_delete=models.SET_NULL)#MJG wants to KILL THIS (redundant information)
|
||||
expedition = models.ForeignKey(Expedition,blank=True, null=True,on_delete=models.SET_NULL) # yes this is double-
|
||||
title = models.CharField(max_length=200)
|
||||
cave_slug = models.SlugField(max_length=50, blank=True, null=True)
|
||||
@@ -70,7 +71,14 @@ class LogbookEntry(TroggleModel):
|
||||
LogbookEntry.objects.get(id=self.id-1)
|
||||
|
||||
def DayIndex(self):
|
||||
return list(self.expeditionday.logbookentry_set.all()).index(self)
|
||||
"""This is used to set different colours for the different trips on
|
||||
the calendar view of the expedition"""
|
||||
index = list(LogbookEntry.objects.filter(date=self.date)).index(self)
|
||||
if index not in range(0,10):
|
||||
print(f"Unexpected LogbookEntry DayIndex '{index}' {self}")
|
||||
index = 0
|
||||
return index
|
||||
|
||||
|
||||
class PersonTrip(TroggleModel):
|
||||
"""Single Person going on a trip, which may or may not be written up.
|
||||
|
||||
Reference in New Issue
Block a user