From fe0765b3b9f91d49b7b053765e377f5106958b80 Mon Sep 17 00:00:00 2001 From: Ernesto Rico-Schmidt Date: Sun, 24 Jul 2011 18:52:57 +0200 Subject: fixed filters for note admin. diff --git a/program/admin.py b/program/admin.py index 9c744e3..e588b87 100644 --- a/program/admin.py +++ b/program/admin.py @@ -28,13 +28,13 @@ class NoteAdmin(admin.ModelAdmin): ordering = ('timeslot',) def queryset(self, request): - return super(NoteAdmin, self).queryset(request).filter(owner=request.user) + shows = request.user.shows.all() + return super(NoteAdmin, self).queryset(request).filter(show__in=shows) def formfield_for_foreignkey(self, db_field, request, **kwargs): if db_field.name == 'timeslot': - one_year_ago = datetime.today() - timedelta(days=365) shows = request.user.shows.all() - kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows, start__gt=one_year_ago) + kwargs['queryset'] = TimeSlot.objects.filter(show__in=shows) return super(NoteAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) -- cgit v0.10.2