summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorJohannes Raggam <raggam-nl@adm.at>2011-07-07 14:15:26 (GMT)
committerJohannes Raggam <raggam-nl@adm.at>2011-07-07 14:15:26 (GMT)
commit7fedd9d25afc2267c23121770d7aef17e9141f0d (patch)
tree13b6455d004067b8e365fde9a2f9f1ad30a5e6fa /program
parentb8192f77d559684825af175dd31ce18c6c38096c (diff)
parentf77ca392735c58e12f3fa5e4f7badf4c6e13f7ae (diff)
Merge branch 'master' of github.com:nnrcschmdt/helsinki
Diffstat (limited to 'program')
-rw-r--r--program/admin.py16
-rw-r--r--program/models.py4
-rw-r--r--program/urls.py4
3 files changed, 6 insertions, 18 deletions
diff --git a/program/admin.py b/program/admin.py
index 63fc2e2..9c744e3 100644
--- a/program/admin.py
+++ b/program/admin.py
@@ -24,25 +24,17 @@ class NoteAdmin(admin.ModelAdmin):
date_hierarchy = 'start'
exclude = ('owner',)
list_display = ('title', 'show', 'start', 'status')
- list_filter = ('status', 'show')
+ list_filter = ('status',)
ordering = ('timeslot',)
def queryset(self, request):
- qs = super(NoteAdmin, self).queryset(request)
-
- if request.user.is_superuser:
- return qs
- else:
- return qs.filter(owner=request.user)
+ return super(NoteAdmin, self).queryset(request).filter(owner=request.user)
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == 'timeslot':
one_year_ago = datetime.today() - timedelta(days=365)
- if request.user.is_superuser:
- kwargs['queryset'] = TimeSlot.objects.filter(start__gt=one_year_ago, note__isnull=True)
- else:
- shows = request.user.shows.all()
- kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows, start__gt=one_year_ago, note__isnull=True)
+ shows = request.user.shows.all()
+ kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows, start__gt=one_year_ago)
return super(NoteAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
diff --git a/program/models.py b/program/models.py
index a63fcc7..8f2e50b 100644
--- a/program/models.py
+++ b/program/models.py
@@ -262,7 +262,7 @@ class TimeSlot(models.Model):
programslot = models.ForeignKey(ProgramSlot, related_name='timeslots', verbose_name=_("Program slot"))
start = models.DateTimeField(_("Start time"), unique=True)
end = models.DateTimeField(_("End time"))
- show = models.ForeignKey(Show, editable=False)
+ show = models.ForeignKey(Show, editable=False, related_name='timeslots')
objects = TimeSlotManager()
@@ -298,7 +298,7 @@ class Note(models.Model):
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)
- show = models.ForeignKey(Show, editable=False)
+ show = models.ForeignKey(Show, editable=False, related_name='notes')
created = models.DateTimeField(auto_now_add=True, editable=False)
last_updated = models.DateTimeField(auto_now=True, editable=False)
diff --git a/program/urls.py b/program/urls.py
index 60d81a7..7176382 100644
--- a/program/urls.py
+++ b/program/urls.py
@@ -5,9 +5,6 @@ from django.views.generic.list_detail import object_detail, object_list
from models import Host, Show, TimeSlot
from views import current_show, day_schedule, recommendations, show_list, week_schedule
-import os
-PROGRAM_STATIC_DIR = os.path.join(os.path.dirname(__file__), '../site_media')
-
hosts_dict = {
'queryset': Host.objects.all(),
'template_object_name': 'host'
@@ -35,5 +32,4 @@ urlpatterns = patterns('',
url(r'^shows/(?P<slug>[\w-]+)/?$', object_detail, shows_dict, name='show-detail'),
url(r'^(?P<object_id>\d+)/?$', object_detail, timeslots_dict, name='timeslot-detail'),
url(r'^week/?$', week_schedule),
- url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': PROGRAM_STATIC_DIR}),
)