summaryrefslogtreecommitdiff
path: root/program/models.py
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-03-21 14:42:52 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-03-21 14:42:52 (GMT)
commitf32b51cdc9dc120a41a120e335a343493d24c47f (patch)
tree55914a93291ca307af6c92bb623d48d70552eb82 /program/models.py
parentae030299ed35505c6b8ace65508035576f45043b (diff)
modified Note: added redundant fields for better admin, limited choices to time slots in the future.
Diffstat (limited to 'program/models.py')
-rw-r--r--program/models.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/program/models.py b/program/models.py
index 37cf904..3864381 100644
--- a/program/models.py
+++ b/program/models.py
@@ -242,12 +242,15 @@ class Note(models.Model):
(1, _("Recommendation")),
(2, _("Repetition")),
)
- timeslot = models.OneToOneField(TimeSlot, verbose_name=_("Time slot"))
+ timeslot = models.OneToOneField(TimeSlot, limit_choices_to={'start__gte': datetime.now}, verbose_name=_("Time slot"))
owner = models.ForeignKey(User, related_name='notes', verbose_name=_("Owner"))
title = models.CharField(_("Title"), max_length=128)
content = models.TextField(_("Content"))
status = models.IntegerField(_("Status"), choices=STATUS_CHOICES, default=1)
cba_entry_id = models.IntegerField(_("CBA entry ID"), blank=True, null=True)
+ start = models.DateTimeField(editable=False)
+ end = models.DateTimeField(editable=False)
+ show = models.ForeignKey(Show, editable=False)
created = models.DateTimeField(auto_now_add=True, editable=False)
last_updated = models.DateTimeField(auto_now=True, editable=False)
@@ -259,5 +262,9 @@ class Note(models.Model):
def __unicode__(self):
return u'%s - %s' % (self.title, self.timeslot)
- def show(self):
- return self.timeslot.programslot.show
+ def save(self, *args, **kwargs):
+ super(Note, self).save(*args, **kwargs)
+
+ self.start = self.timeslot.start
+ self.end = self.timeslot.end
+ self.show = self.timeslot.programslot.show