2012-08-30 01:53:15 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2012-08-31 02:36:24 +00:00
|
|
|
from markitup.fields import MarkupField
|
|
|
|
|
2012-08-31 02:43:43 +00:00
|
|
|
from symposion.proposals.models import ProposalBase
|
|
|
|
from symposion.conference.models import Section
|
|
|
|
|
2012-08-30 01:53:15 +00:00
|
|
|
|
|
|
|
class Schedule(models.Model):
|
|
|
|
|
|
|
|
section = models.OneToOneField(Section)
|
2012-08-30 06:21:48 +00:00
|
|
|
slug = models.SlugField(unique=True)
|
2012-08-30 01:53:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
kind = models.ForeignKey(SlotKind)
|
2012-08-30 01:53:15 +00:00
|
|
|
start = models.TimeField()
|
|
|
|
end = models.TimeField()
|
2012-08-30 17:52:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SlotRoom(models.Model):
|
|
|
|
"""
|
|
|
|
Links a slot with a room.
|
|
|
|
"""
|
|
|
|
|
|
|
|
slot = models.ForeignKey(Slot)
|
|
|
|
room = models.ForeignKey(Room)
|
2012-08-30 01:53:15 +00:00
|
|
|
|
2012-08-30 17:52:11 +00:00
|
|
|
class Meta:
|
|
|
|
unique_together = [("slot", "room")]
|
2012-08-31 02:36:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Presentation(models.Model):
|
|
|
|
|
|
|
|
slot = models.OneToOneField(Slot, null=True, blank=True, related_name="presentation")
|
|
|
|
title = models.CharField(max_length=100)
|
2012-08-31 02:57:58 +00:00
|
|
|
description = MarkupField()
|
|
|
|
abstract = MarkupField()
|
2012-08-31 02:36:24 +00:00
|
|
|
speaker = models.ForeignKey("speakers.Speaker", related_name="presentations")
|
|
|
|
additional_speakers = models.ManyToManyField("speakers.Speaker", blank=True)
|
|
|
|
cancelled = models.BooleanField(default=False)
|
2012-09-13 20:39:58 +00:00
|
|
|
proposal_base = models.OneToOneField(ProposalBase, related_name="presentation")
|
2012-08-31 02:55:44 +00:00
|
|
|
section = models.ForeignKey(Section, related_name="presentations")
|
2012-08-31 02:43:43 +00:00
|
|
|
|
2012-08-31 07:05:52 +00:00
|
|
|
@property
|
|
|
|
def number(self):
|
|
|
|
return self.proposal.number
|
|
|
|
|
2012-08-31 02:43:43 +00:00
|
|
|
@property
|
|
|
|
def proposal(self):
|
2012-09-13 20:39:58 +00:00
|
|
|
if self.proposal_base_id is None:
|
|
|
|
return None
|
|
|
|
return ProposalBase.objects.get_subclass(pk=self.proposal_base_id)
|
2012-08-31 02:36:24 +00:00
|
|
|
|
|
|
|
def speakers(self):
|
|
|
|
yield self.speaker
|
|
|
|
for speaker in self.additional_speakers.all():
|
|
|
|
yield speaker
|
|
|
|
|
|
|
|
def __unicode__(self):
|
2012-08-31 07:05:52 +00:00
|
|
|
return "#%s %s (%s)" % (self.number, self.title, self.speaker)
|