Commits

James Bennett committed f0a3c45

Use wrapped generic view for category detail (p. 87).

  • Participants
  • Parent commits 97660d6

Comments (0)

Files changed (1)

File coltrane/views.py

-from django.shortcuts import get_object_or_404, render_to_response
+from django.shortcuts import get_object_or_404
+from django.views.generic.list_detail import object_list
 
 from coltrane.models import Category
 
 
 def category_detail(request, slug):
     category = get_object_or_404(Category, slug=slug)
-    return render_to_response('coltrane/category_detail.html',
-                              { 'object_list': category.entry_set.all(),
-                                'category': category })
+    return object_list(request, queryset=category.entry_set.all(),
+                       extra_context={ 'category': category })