Commit 3058fc83 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added dates to integers-- integerfield now has choices from 0-6

parent 51cce9cb
...@@ -90,10 +90,29 @@ class Schedule(BaseModel): ...@@ -90,10 +90,29 @@ class Schedule(BaseModel):
class OpenTime(BaseModel): class OpenTime(BaseModel):
"""Represents a period time when a Facility is open""" """Represents a period time when a Facility is open"""
MONDAY = 0
TUESDAY = 1
WEDNESDAY = 2
THURSDAY = 3
FRIDAY = 4
SATURDAY = 5
SUNDAY = 6
DAY_CHOICES = (
(MONDAY, 'Monday'),
(TUESDAY, 'Tuesday'),
(WEDNESDAY, 'Wednesday'),
(THURSDAY, 'Thursday'),
(FRIDAY, 'Friday'),
(SATURDAY, 'Saturday'),
(SUNDAY, 'Sunday'),
)
schedule = models.ForeignKey('Schedule', related_name='open_times') schedule = models.ForeignKey('Schedule', related_name='open_times')
start_day = models.IntegerField() # 0-6, Monday == 0 start_day = models.IntegerField(default=0, choices=DAY_CHOICES)
start_time = models.TimeField() start_time = models.TimeField()
end_day = models.IntegerField() # 0-6, Monday == 0 end_day = models.IntegerField(default=0, choices=DAY_CHOICES)
end_time = models.TimeField() end_time = models.TimeField()
def isOpenNow(self): def isOpenNow(self):
......
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