summaryrefslogtreecommitdiff
path: root/program/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'program/models.py')
-rw-r--r--program/models.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/program/models.py b/program/models.py
index b11d180..9945145 100644
--- a/program/models.py
+++ b/program/models.py
@@ -211,7 +211,6 @@ class MusicFocus(models.Model):
class Host(models.Model):
name = models.CharField(_("Name"), max_length=128)
is_always_visible = models.BooleanField(_("Is always visible"), default=False)
- is_active = models.BooleanField(_("Is active"), default=True, editable=False)
email = models.EmailField(_("E-Mail"), blank=True)
website = models.URLField(_("Website"), blank=True)
@@ -226,6 +225,9 @@ class Host(models.Model):
def get_absolute_url(self):
return reverse('host-detail', args=[str(self.id)])
+ def active_shows(self):
+ return self.shows.filter(programslots__until__gt=datetime.today())
+
class Show(models.Model):
predecessor = models.ForeignKey('self', blank=True, null=True, related_name='successors', verbose_name=_("Predecessor"))
@@ -243,7 +245,6 @@ class Show(models.Model):
description = tinymce_models.HTMLField(_("Description"), blank=True, null=True)
email = models.EmailField(_("E-Mail"), blank=True, null=True)
website = models.URLField(_("Website"), blank=True, null=True)
- is_active = models.BooleanField(_("Is active"), default=True, editable=False)
created = models.DateTimeField(auto_now_add=True, editable=False)
last_updated = models.DateTimeField(auto_now=True, editable=False)
@@ -258,6 +259,9 @@ class Show(models.Model):
def get_absolute_url(self):
return reverse('show-detail', args=[self.slug])
+ def active_programslots(self):
+ return self.programslots.filter(until__gt=date.today())
+
class RRule(models.Model):
FREQ_CHOICES = (
@@ -306,7 +310,6 @@ class ProgramSlot(models.Model):
tstart = models.TimeField(_("Start time"))
tend = models.TimeField(_("End time"))
until = models.DateField(_("Last date"))
- is_active = models.BooleanField(_("Is active"), default=True, editable=False)
is_repetition = models.BooleanField(_("Is repetition"), default=False)
automation_id = models.IntegerField(_("Automation ID"), blank=True, null=True, choices=get_automation_id_choices())
created = models.DateTimeField(auto_now_add=True, editable=False)
@@ -351,9 +354,6 @@ class ProgramSlot(models.Model):
else:
old = False
- self.is_active = self.until > date.today()
- self.show.is_active = self.until > date.today()
-
super(ProgramSlot, self).save(*args, **kwargs)
if self.rrule.freq == 0: