summaryrefslogtreecommitdiff
path: root/program/admin.py
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-06-18 13:44:05 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-06-18 13:44:05 (GMT)
commit2c8661d1e17cdd26d5f347d8a5fb332b5d267fe6 (patch)
tree077b36382d33d5713d4373be240a8c579b4c4f73 /program/admin.py
parent786ab8d4a6f05e6cb8ab138cd4ef78ea5e24b531 (diff)
made note administration more usable
Diffstat (limited to 'program/admin.py')
-rw-r--r--program/admin.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/program/admin.py b/program/admin.py
index 6c64dd3..63fc2e2 100644
--- a/program/admin.py
+++ b/program/admin.py
@@ -1,6 +1,6 @@
from django.contrib import admin
-from datetime import datetime
+from datetime import datetime, timedelta
from models import BroadcastFormat, MusicFocus, ShowInformation, ShowTopic, Host, Note, ProgramSlot, Show, TimeSlot
@@ -22,8 +22,9 @@ class ShowTopicAdmin(admin.ModelAdmin):
class NoteAdmin(admin.ModelAdmin):
date_hierarchy = 'start'
+ exclude = ('owner',)
list_display = ('title', 'show', 'start', 'status')
- list_filter = ('status',)
+ list_filter = ('status', 'show')
ordering = ('timeslot',)
def queryset(self, request):
@@ -36,11 +37,12 @@ class NoteAdmin(admin.ModelAdmin):
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=datetime.now)
+ 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=datetime.now)
+ 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)