diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-03-12 16:29:14 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2011-03-12 16:29:14 (GMT) |
commit | d73acae47afb4dfd255c51eeb8619bc63792ef87 (patch) | |
tree | 3135e7f807727ce68846cd0447a0b4e4c371e53d | |
parent | 9f0c50c9ec625ae021956247dfa257e8790ce0b4 (diff) |
added recommendations box.
-rw-r--r-- | program/urls.py | 3 | ||||
-rw-r--r-- | program/views.py | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/program/urls.py b/program/urls.py index 9dfc811..0a9fd5b 100644 --- a/program/urls.py +++ b/program/urls.py @@ -3,12 +3,13 @@ from django.views.generic.detail import DetailView from django.views.generic.list import ListView from models import Host, Show, TimeSlot -from views import RecommendationsView, ShowListView +from views import RecommendationsView, RecommendationsBoxView, ShowListView urlpatterns = patterns('', url('^hosts/$', ListView.as_view(model=Host,context_object_name='host_list')), url('^host/(?P<pk>\d+)/$', DetailView.as_view(model=Host), name='host-detail'), url('^recommendations/$', RecommendationsView.as_view()), + url('^recommendations_box/$', RecommendationsBoxView.as_view()), url('^shows/$', ShowListView.as_view()), url('^show/(?P<slug>[\w-]+)/$', DetailView.as_view(model=Show), name='show-detail'), url('^timeslot/(?P<pk>\d+)/$', DetailView.as_view(model=TimeSlot, context_object_name='timeslot'), name='timeslot-detail'), diff --git a/program/views.py b/program/views.py index 73a1298..a3d1807 100644 --- a/program/views.py +++ b/program/views.py @@ -24,3 +24,8 @@ class RecommendationsView(ListView): context_object_name = 'recommendation_list' template_name = 'program/recommendations.html' queryset = Note.objects.filter(status=1, timeslot__start__range=(now, in_one_week))[:10] + +class RecommendationsBoxView(RecommendationsView): + now = datetime.now() + in_one_week = now + timedelta(weeks=1) + queryset = Note.objects.filter(status=1, timeslot__start__range=(now, in_one_week))[:3] |