diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-07-02 20:22:03 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-07-02 20:22:03 (GMT) |
commit | 35e740a416605d3dbe6733ca7dc6497225eb5f58 (patch) | |
tree | 3010230fc7203b6e8a9b6e2bbf466c73b510a334 /program | |
parent | b67150d8ed0b7404a4d62f7f65a42620f22bc9c6 (diff) |
removed show from filter for note admin.
Diffstat (limited to 'program')
-rw-r--r-- | program/admin.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/program/admin.py b/program/admin.py index 63fc2e2..ad9d725 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, note__isnull=True) return super(NoteAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs) |