correction de bugs
This commit is contained in:
parent
1672fbaf67
commit
4ea0093c8e
@ -62,6 +62,7 @@ class CalendarList:
|
|||||||
def __init__(self, firstdate, lastdate):
|
def __init__(self, firstdate, lastdate):
|
||||||
self.firstdate = firstdate
|
self.firstdate = firstdate
|
||||||
self.lastdate = lastdate
|
self.lastdate = lastdate
|
||||||
|
self.now = date.today()
|
||||||
|
|
||||||
# start the first day of the first week
|
# start the first day of the first week
|
||||||
self.c_firstdate = firstdate + timedelta(days=-firstdate.weekday())
|
self.c_firstdate = firstdate + timedelta(days=-firstdate.weekday())
|
||||||
@ -77,16 +78,10 @@ class CalendarList:
|
|||||||
|
|
||||||
|
|
||||||
def today_in_calendar(self):
|
def today_in_calendar(self):
|
||||||
for d in self.calendar_days.values():
|
return self.firstdate <= self.now and self.lastdate >= self.now
|
||||||
if not d.is_today():
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def all_in_past(self):
|
def all_in_past(self):
|
||||||
for d in self.calendar_days.values():
|
return self.lastdate < self.now
|
||||||
if not d.is_in_past():
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def fill_calendar_days(self):
|
def fill_calendar_days(self):
|
||||||
self.events = Event.objects.filter(start_day__lte=self.c_lastdate, start_day__gte=self.c_firstdate).order_by("start_day", "start_time")
|
self.events = Event.objects.filter(start_day__lte=self.c_lastdate, start_day__gte=self.c_firstdate).order_by("start_day", "start_time")
|
||||||
|
Loading…
Reference in New Issue
Block a user