diff options
author | Johannes Raggam <raggam-nl@adm.at> | 2011-07-07 14:15:26 (GMT) |
---|---|---|
committer | Johannes Raggam <raggam-nl@adm.at> | 2011-07-07 14:15:26 (GMT) |
commit | 7fedd9d25afc2267c23121770d7aef17e9141f0d (patch) | |
tree | 13b6455d004067b8e365fde9a2f9f1ad30a5e6fa /program/admin.py | |
parent | b8192f77d559684825af175dd31ce18c6c38096c (diff) | |
parent | f77ca392735c58e12f3fa5e4f7badf4c6e13f7ae (diff) |
Merge branch 'master' of github.com:nnrcschmdt/helsinki
Diffstat (limited to 'program/admin.py')
-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..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) |