summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/admin.py2
-rw-r--r--program/models.py7
2 files changed, 7 insertions, 2 deletions
diff --git a/program/admin.py b/program/admin.py
index d3712ef..5a6ce7f 100644
--- a/program/admin.py
+++ b/program/admin.py
@@ -41,7 +41,7 @@ class ProgramSlotInline(admin.TabularInline):
class ShowAdmin(admin.ModelAdmin):
filter_horizontal = ('hosts', 'owners', 'musicfocus', 'showinformation', 'showtopic')
inlines = (ProgramSlotInline,)
- list_display = ('name', 'short_description', 'broadcastformat')
+ list_display = ('name', 'short_description', 'broadcastformat', 'has_active_programslots')
list_filter = ('broadcastformat', 'showinformation', 'showtopic', 'musicfocus',)
ordering = ('slug',)
prepopulated_fields = {'slug': ('name',)}
diff --git a/program/models.py b/program/models.py
index 8aac8cc..1355e5a 100644
--- a/program/models.py
+++ b/program/models.py
@@ -2,7 +2,7 @@ from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
-from datetime import datetime
+from datetime import date, datetime
from dateutil.relativedelta import relativedelta
from dateutil.rrule import rrule
@@ -105,6 +105,11 @@ class Show(models.Model):
def get_absolute_url(self):
return ('show-detail', [self.slug])
+ def has_active_programslots(self):
+ return self.programslots.filter(until__gt=date.today()).count() > 0
+ has_active_programslots.boolean = True
+ has_active_programslots.short_description = _("Has active program slots")
+
class RRule(models.Model):
FREQ_CHOICES = (
(1, _("Monthly")),