Commit 89e3f4f1 authored by David Haynes's avatar David Haynes 🙆

Merge branch '70-valid-dates-datetime' into '2.1-dev'

Alter valid_end and valid_start to use DateTime

See merge request !28
parents ccade0a0 4fb2679b
Pipeline #1715 passed with stage
in 1 minute and 50 seconds
......@@ -187,12 +187,13 @@ class Schedule(TimeStampedModel):
# The start date of the schedule
# (inclusive)
valid_start = models.DateField('Start Date', null=True, blank=True,
help_text="Date that this schedule goes into effect")
valid_start = models.DateTimeField('Start Date', null=True, blank=True,
help_text="Date & time that this schedule goes into effect")
# The end date of the schedule
# (inclusive)
valid_end = models.DateField('End Date', null=True, blank=True,
help_text="Last day that this schedule is in effect")
valid_end = models.DateTimeField('End Date', null=True, blank=True,
help_text="Last date & time that this schedule is in effect")
# Boolean for if this schedule is 24 hours
twenty_four_hours = models.BooleanField('24 hour schedule?', blank=True,
default=False, help_text="Toggle to True if the Facility is open 24 hours. You do not need to specify any Open Times, it will always be displayed as open.")
......
......@@ -509,7 +509,7 @@ class ScheduleViewSet(viewsets.ModelViewSet):
for schedule in Schedule.objects.all()
# If the schedule ended before today
if schedule.valid_end and schedule.valid_start
if schedule.valid_end < datetime.date.today()
if schedule.valid_end < datetime.today()
]
# Return all Schedule objects that have not expired
return Schedule.objects.exclude(pk__in=filter_old_schedules)
......
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