As we discussed in Chapter 2, generic views are used to cut down on the number of boilerplate views we end up writing in many web applications. The paginating results in these pages are also very common, and are built into the handling of generic views.
Instead of replacing our current list view, let's add another URL configuration to the mycompany/press/urls.py
file. Add the highlighted lines:
from django.conf.urls.defaults import * from mycompany.press.models import PressRelease press_list_dict = { 'queryset': PressRelease.objects.all(), 'template_name': 'press/list.html', 'allow_empty': False, 'template_object_name': 'press', 'paginate_by': 10, } urlpatterns = patterns('', (r'detail/(?P<pid>\d+)/$','mycompany.press.views.detail'), (r'list/$','mycompany.press.views.press_list'), (r'list2/', 'django.views.generic.list_detail.object_list', press_list_dict), (r'latest...