summaryrefslogtreecommitdiff
path: root/program/views.py
diff options
context:
space:
mode:
authorErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-03-12 15:14:15 (GMT)
committerErnesto Rico-Schmidt <e.rico.schmidt@gmail.com>2011-03-12 15:14:15 (GMT)
commit3e1c4f43fb5ea31d729f92a1bc71b622c2531ab2 (patch)
tree756406f791b2ca8915e39701e534fa19a27b7539 /program/views.py
parent235719f0621b5e36d877d76cfaf40cdb43033a6e (diff)
renamed model attributes to be more consistent, updated templates accordingly. added recommendations view and template.
Diffstat (limited to 'program/views.py')
-rw-r--r--program/views.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/program/views.py b/program/views.py
index c6974b9..73a1298 100644
--- a/program/views.py
+++ b/program/views.py
@@ -1,6 +1,8 @@
-from django.views.generic.list import ListView
+from django.views.generic import ListView
-from models import BroadcastFormat, MusicFocus, Show, ShowInformation, ShowTopic
+from models import BroadcastFormat, MusicFocus, Note, Show, ShowInformation, ShowTopic
+
+from datetime import datetime, timedelta
class ShowListView(ListView):
context_object_name = 'show_list'
@@ -9,9 +11,16 @@ class ShowListView(ListView):
def get_context_data(self, **kwargs):
context = super(ShowListView, self).get_context_data(**kwargs)
- context['broadcast_format_list'] = BroadcastFormat.objects.all()
- context['music_focus_list'] = MusicFocus.objects.all()
- context['show_information_list'] = ShowInformation.objects.all()
- context['show_topic_list'] = ShowTopic.objects.all()
+ context['broadcastformat_list'] = BroadcastFormat.objects.all()
+ context['musicfocus_list'] = MusicFocus.objects.all()
+ context['showinformation_list'] = ShowInformation.objects.all()
+ context['showtopic_list'] = ShowTopic.objects.all()
+
+ return context
- return context \ No newline at end of file
+class RecommendationsView(ListView):
+ now = datetime.now()
+ in_one_week = now + timedelta(weeks=1)
+ context_object_name = 'recommendation_list'
+ template_name = 'program/recommendations.html'
+ queryset = Note.objects.filter(status=1, timeslot__start__range=(now, in_one_week))[:10]