Commit dedb55d9 authored by Michael T Bailey's avatar Michael T Bailey
Browse files

Issue 11 fix

parent e139160a
Pipeline #2124 passed with stage
in 1 minute and 25 seconds
......@@ -94,7 +94,7 @@ class Location(TimeStampedModel):
class StupidFacilityLabelHack(TagBase):
pass
class StupidLabelHack(GenericTaggedItemBase):
tag = models.ForeignKey(StupidFacilityLabelHack, on_delete=models.CASCADE)
tag = models.ForeignKey(StupidFacilityLabelHack, on_delete=models.CASCADE, related_name="%(app_label)s_%(class)s_items")
class Facility(TimeStampedModel):
"""
......@@ -209,10 +209,10 @@ class Facility(TimeStampedModel):
"""
for special_schedule in self.special_schedules.all():
# If it ends before today
if special_schedule.valid_end < datetime.date.today() and special_schedule.schedule_for_removal:
if special_schedule.valid_end < timezone.now() and special_schedule.schedule_for_removal:
self.special_schedules.remove(special_schedule)
elif special_schedule.promote_to_main:
if special_schedule.valid_start < datetime.date.today() and special_schedule.valid_end >= datetime.date.today():
if special_schedule.valid_start < timezone.now() and special_schedule.valid_end >= timezone.now():
self.main_schedule = special_schedule
class Meta:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment