2012-08-30 01:53:15 +00:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
from symposion.conference.models import Section
|
2012-08-30 05:58:03 +00:00
|
|
|
from symposion.schedule.utils import InlineSet
|
2012-08-30 01:53:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Schedule(models.Model):
|
|
|
|
|
|
|
|
section = models.OneToOneField(Section)
|
|
|
|
|
|
|
|
|
|
|
|
class Day(models.Model):
|
|
|
|
|
2012-08-30 05:58:03 +00:00
|
|
|
schedule = models.ForeignKey(Schedule)
|
2012-08-30 01:53:15 +00:00
|
|
|
date = models.DateField()
|
2012-08-30 05:58:03 +00:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
unique_together = [("schedule", "date")]
|
2012-08-30 01:53:15 +00:00
|
|
|
|
|
|
|
|
2012-08-30 05:58:03 +00:00
|
|
|
class Room(models.Model):
|
2012-08-30 01:53:15 +00:00
|
|
|
|
2012-08-30 05:58:03 +00:00
|
|
|
schedule = models.ForeignKey(Schedule)
|
2012-08-30 01:53:15 +00:00
|
|
|
name = models.CharField(max_length=65)
|
2012-08-30 05:58:03 +00:00
|
|
|
order = models.PositiveIntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class SlotKind(models.Model):
|
|
|
|
"""
|
|
|
|
A slot kind represents what kind a slot is. For example, a slot can be a
|
|
|
|
break, lunch, or X-minute talk.
|
|
|
|
"""
|
|
|
|
|
|
|
|
schedule = models.ForeignKey(Schedule)
|
|
|
|
label = models.CharField(max_length=50)
|
2012-08-30 01:53:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Slot(models.Model):
|
|
|
|
|
|
|
|
day = models.ForeignKey(Day)
|
2012-08-30 05:58:03 +00:00
|
|
|
room_set = models.TextField(db_column="rooms")
|
|
|
|
kind = models.ForeignKey(SlotKind)
|
2012-08-30 01:53:15 +00:00
|
|
|
start = models.TimeField()
|
|
|
|
end = models.TimeField()
|
|
|
|
|
|
|
|
@property
|
2012-08-30 05:58:03 +00:00
|
|
|
def rooms(self):
|
|
|
|
attr = "_rooms"
|
2012-08-30 01:53:15 +00:00
|
|
|
if not hasattr(self, attr):
|
2012-08-30 05:58:03 +00:00
|
|
|
setattr(self, attr, InlineSet(obj=self, field="room_set", delimiter=" "))
|
2012-08-30 01:53:15 +00:00
|
|
|
return getattr(self, attr)
|