Commit 08578877 authored by Benjamin S Waters's avatar Benjamin S Waters
Browse files

fixed open time model

parent 673344aa
......@@ -66,20 +66,10 @@ class Migration(SchemaMigration):
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
('schedule', self.gf('django.db.models.fields.related.ForeignKey')(related_name='open_times', to=orm['website.Schedule'])),
('monday_start', self.gf('django.db.models.fields.TimeField')()),
('monday_end', self.gf('django.db.models.fields.TimeField')()),
('tuesday_start', self.gf('django.db.models.fields.TimeField')()),
('tuesday_end', self.gf('django.db.models.fields.TimeField')()),
('wednesday_start', self.gf('django.db.models.fields.TimeField')()),
('wednesday_end', self.gf('django.db.models.fields.TimeField')()),
('thursday_start', self.gf('django.db.models.fields.TimeField')()),
('thursday_end', self.gf('django.db.models.fields.TimeField')()),
('friday_start', self.gf('django.db.models.fields.TimeField')()),
('friday_end', self.gf('django.db.models.fields.TimeField')()),
('saturday_start', self.gf('django.db.models.fields.TimeField')()),
('saturday_end', self.gf('django.db.models.fields.TimeField')()),
('sunday_start', self.gf('django.db.models.fields.TimeField')()),
('sunday_end', self.gf('django.db.models.fields.TimeField')()),
('start_day', self.gf('django.db.models.fields.IntegerField')()),
('start_time', self.gf('django.db.models.fields.TimeField')()),
('end_day', self.gf('django.db.models.fields.IntegerField')()),
('end_time', self.gf('django.db.models.fields.TimeField')()),
))
db.send_create_signal(u'website', ['OpenTime'])
......@@ -165,23 +155,13 @@ class Migration(SchemaMigration):
u'website.opentime': {
'Meta': {'object_name': 'OpenTime'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'friday_end': ('django.db.models.fields.TimeField', [], {}),
'friday_start': ('django.db.models.fields.TimeField', [], {}),
'end_day': ('django.db.models.fields.IntegerField', [], {}),
'end_time': ('django.db.models.fields.TimeField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'monday_end': ('django.db.models.fields.TimeField', [], {}),
'monday_start': ('django.db.models.fields.TimeField', [], {}),
'saturday_end': ('django.db.models.fields.TimeField', [], {}),
'saturday_start': ('django.db.models.fields.TimeField', [], {}),
'schedule': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'open_times'", 'to': u"orm['website.Schedule']"}),
'sunday_end': ('django.db.models.fields.TimeField', [], {}),
'sunday_start': ('django.db.models.fields.TimeField', [], {}),
'thursday_end': ('django.db.models.fields.TimeField', [], {}),
'thursday_start': ('django.db.models.fields.TimeField', [], {}),
'tuesday_end': ('django.db.models.fields.TimeField', [], {}),
'tuesday_start': ('django.db.models.fields.TimeField', [], {}),
'wednesday_end': ('django.db.models.fields.TimeField', [], {}),
'wednesday_start': ('django.db.models.fields.TimeField', [], {})
'start_day': ('django.db.models.fields.IntegerField', [], {}),
'start_time': ('django.db.models.fields.TimeField', [], {})
},
u'website.schedule': {
'Meta': {'ordering': "['name']", 'object_name': 'Schedule'},
......
......@@ -90,20 +90,11 @@ class Schedule(TimeStampedModel):
class OpenTime(TimeStampedModel):
"""Represents a period time when a Facility is open"""
schedule = models.ForeignKey('Schedule', related_name='open_times')
monday_start = models.TimeField()
monday_end = models.TimeField()
tuesday_start = models.TimeField()
tuesday_end = models.TimeField()
wednesday_start = models.TimeField()
wednesday_end = models.TimeField()
thursday_start = models.TimeField()
thursday_end = models.TimeField()
friday_start = models.TimeField()
friday_end = models.TimeField()
saturday_start = models.TimeField(blank=True,null=True)
saturday_end = models.TimeField(blank=True,null=True)
sunday_start = models.TimeField(blank=True,null=True)
sunday_end = models.TimeField(blank=True,null=True)
schedule = models.ForeignKey('Schedule', related_name='open_times')
start_day = models.IntegerField() # 0-6, Monday == 0
start_time = models.TimeField()
end_day = models.IntegerField() # 0-6, Monday == 0
end_time = models.TimeField()
def isOpenNow(self):
"""Return true if the current time is this OpenTime's range"""
......
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