# Path: symposion/proposals/models.py
# class ProposalBase(models.Model):
#     
#     objects = InheritanceManager()
#     
#     kind = models.ForeignKey(ProposalKind)
#     
#     title = models.CharField(max_length=100)
#     description = models.TextField(
#         _("Brief Outline"),
#         max_length=400,  # @@@ need to enforce 400 in UI
#         help_text="If your talk is accepted this will be made public and printed in the program. Should be one paragraph, maximum 400 characters."
#     )
#     abstract = MarkupField(
#         _("Detailed Abstract"),
#         help_text=_("Detailed description and outline. Will be made public if your talk is accepted. Edit using <a href='http://daringfireball.net/projects/markdown/basics' target='_blank'>Markdown</a>.")
#     )
#     additional_notes = MarkupField(
#         blank=True,
#         help_text=_("Anything else you'd like the program committee to know when making their selection: your past speaking experience, open source community experience, etc. Edit using <a href='http://daringfireball.net/projects/markdown/basics' target='_blank'>Markdown</a>.")
#     )
#     submitted = models.DateTimeField(
#         default=datetime.datetime.now,
#         editable=False,
#     )
#     speaker = models.ForeignKey("speakers.Speaker", related_name="proposals")
#     additional_speakers = models.ManyToManyField("speakers.Speaker", through="AdditionalSpeaker", blank=True)
#     cancelled = models.BooleanField(default=False)
#     
#     def can_edit(self):
#         if hasattr(self, "presentation") and self.presentation:
#             return False
#         else:
#             return True
#     
#     @property
#     def section(self):
#         return self.kind.section
#     
#     @property
#     def speaker_email(self):
#         return self.speaker.email
#     
#     @property
#     def number(self):
#         return str(self.pk).zfill(3)
#     
#     def speakers(self):
#         yield self.speaker
#         for speaker in self.additional_speakers.exclude(additionalspeaker__status=AdditionalSpeaker.SPEAKING_STATUS_DECLINED):
#             yield speaker
#     
#     def notification_email_context(self):
#         return {
#             "title": self.title,
#             "speaker": self.speaker.name,
#             "kind": self.kind.name,
#         }
# 
# Path: symposion/conference/models.py
# class Section(models.Model):
#     """
#     a section of the conference such as "Tutorials", "Workshops",
#     "Talks", "Expo", "Sprints", that may have its own review and
#     scheduling process.
#     """
#     
#     conference = models.ForeignKey(Conference, verbose_name=_("conference"))
#     
#     name = models.CharField(_("name"), max_length=100)
#     slug = models.SlugField()
# 
#     # when the section runs
#     start_date = models.DateField(_("start date"), null=True, blank=True)
#     end_date = models.DateField(_("end date"), null=True, blank=True)
#     
#     def __unicode__(self):
#         return "%s %s" % (self.conference, self.name)
#     
#     class Meta(object):
#         verbose_name = _("section")
#         verbose_name_plural = _("sections")


from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from markitup.fields import MarkupField
from model_utils.managers import InheritanceManager
from symposion.proposals.models import ProposalBase
from symposion.conference.models import Section
    class Meta:
        ordering = ["day", "start", "end"]


class SlotRoom(models.Model):
    """
    Links a slot with a room.
    """
    
    slot = models.ForeignKey(Slot)
    room = models.ForeignKey(Room)
    
    def __unicode__(self):
        return "%s %s" % (self.room, self.slot)
    
    class Meta:
        unique_together = [("slot", "room")]
        ordering = ["slot", "room__order"]


class Presentation(models.Model):
    
    slot = models.OneToOneField(Slot, null=True, blank=True, related_name="content_ptr")
    title = models.CharField(max_length=100)
    description = MarkupField()
    abstract = MarkupField()
    speaker = models.ForeignKey("speakers.Speaker", related_name="presentations")
    additional_speakers = models.ManyToManyField("speakers.Speaker", related_name="copresentations", blank=True)
    cancelled = models.BooleanField(default=False)
    proposal_base = models.OneToOneField(ProposalBase, related_name="presentation")

# Path: symposion/proposals/models.py
# class ProposalBase(models.Model):
#     
#     objects = InheritanceManager()
#     
#     kind = models.ForeignKey(ProposalKind)
#     
#     title = models.CharField(max_length=100)
#     description = models.TextField(
#         _("Brief Outline"),
#         max_length=400,  # @@@ need to enforce 400 in UI
#         help_text="If your talk is accepted this will be made public and printed in the program. Should be one paragraph, maximum 400 characters."
#     )
#     abstract = MarkupField(
#         _("Detailed Abstract"),
#         help_text=_("Detailed description and outline. Will be made public if your talk is accepted. Edit using <a href='http://daringfireball.net/projects/markdown/basics' target='_blank'>Markdown</a>.")
#     )
#     additional_notes = MarkupField(
#         blank=True,
#         help_text=_("Anything else you'd like the program committee to know when making their selection: your past speaking experience, open source community experience, etc. Edit using <a href='http://daringfireball.net/projects/markdown/basics' target='_blank'>Markdown</a>.")
#     )
#     submitted = models.DateTimeField(
#         default=datetime.datetime.now,
#         editable=False,
#     )
#     speaker = models.ForeignKey("speakers.Speaker", related_name="proposals")
#     additional_speakers = models.ManyToManyField("speakers.Speaker", through="AdditionalSpeaker", blank=True)
#     cancelled = models.BooleanField(default=False)
#     
#     def can_edit(self):
#         if hasattr(self, "presentation") and self.presentation:
#             return False
#         else:
#             return True
#     
#     @property
#     def section(self):
#         return self.kind.section
#     
#     @property
#     def speaker_email(self):
#         return self.speaker.email
#     
#     @property
#     def number(self):
#         return str(self.pk).zfill(3)
#     
#     def speakers(self):
#         yield self.speaker
#         for speaker in self.additional_speakers.exclude(additionalspeaker__status=AdditionalSpeaker.SPEAKING_STATUS_DECLINED):
#             yield speaker
#     
#     def notification_email_context(self):
#         return {
#             "title": self.title,
#             "speaker": self.speaker.name,
#             "kind": self.kind.name,
#         }
# 
# Path: symposion/conference/models.py
# class Section(models.Model):
#     """
#     a section of the conference such as "Tutorials", "Workshops",
#     "Talks", "Expo", "Sprints", that may have its own review and
#     scheduling process.
#     """
#     
#     conference = models.ForeignKey(Conference, verbose_name=_("conference"))
#     
#     name = models.CharField(_("name"), max_length=100)
#     slug = models.SlugField()
# 
#     # when the section runs
#     start_date = models.DateField(_("start date"), null=True, blank=True)
#     end_date = models.DateField(_("end date"), null=True, blank=True)
#     
#     def __unicode__(self):
#         return "%s %s" % (self.conference, self.name)
#     
#     class Meta(object):
#         verbose_name = _("section")
#         verbose_name_plural = _("sections")


# Path: symposion/schedule/models.py
from datetime import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from markitup.fields import MarkupField
from model_utils.managers import InheritanceManager
from symposion.proposals.models import ProposalBase
from symposion.conference.models import Section

    class Meta:
        ordering = ["day", "start", "end"]


class SlotRoom(models.Model):
    """
    Links a slot with a room.
    """
    
    slot = models.ForeignKey(Slot)
    room = models.ForeignKey(Room)
    
    def __unicode__(self):
        return "%s %s" % (self.room, self.slot)
    
    class Meta:
        unique_together = [("slot", "room")]
        ordering = ["slot", "room__order"]


class Presentation(models.Model):
    
    slot = models.OneToOneField(Slot, null=True, blank=True, related_name="content_ptr")
    title = models.CharField(max_length=100)
    description = MarkupField()
    abstract = MarkupField()
    speaker = models.ForeignKey("speakers.Speaker", related_name="presentations")
    additional_speakers = models.ManyToManyField("speakers.Speaker", related_name="copresentations", blank=True)
    cancelled = models.BooleanField(default=False)
    proposal_base = models.OneToOneField(ProposalBase, related_name="presentation")

    section = models.ForeignKey(Section, related_name="presentations")