From 4d63cb721d78a8bf6d5b4af095fde07c72abf13c Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Mon, 21 Mar 2011 15:58:30 +0100 Subject: modified Time slot: added redundant field. diff --git a/program/models.py b/program/models.py index 3864381..8aac8cc 100644 --- a/program/models.py +++ b/program/models.py @@ -217,6 +217,7 @@ class TimeSlot(models.Model): programslot = models.ForeignKey(ProgramSlot, related_name='timeslots', verbose_name=_("Program slot")) start = models.DateTimeField(_("Start time")) end = models.DateTimeField(_("End time")) + show = models.ForeignKey(Show, editable=False) class Meta: ordering = ('start', 'end') @@ -227,10 +228,12 @@ class TimeSlot(models.Model): start = self.start.strftime('%d. %b %Y %H:%M') end = self.end.strftime('%H:%M') - return u'%s: %s - %s' % (self.show(), start, end) + return u'%s: %s - %s' % (self.show, start, end) + + def save(self, *args, **kwargs): + super(TimeSlot, self).save(*args, **kwargs) - def show(self): - return self.programslot.show + self.show = self.programslot.show @models.permalink def get_absolute_url(self): -- cgit v0.10.2