使用的仍然是Django的generic view。

1、修改urls,增加分頁(yè)顯示參數(shù)
    (r'^film/list/?$''django.views.generic.list_detail.object_list'
        dict(paginate_by
=5**info_dict)),

2、修改模板,加上分頁(yè)顯示。需要注意上一頁(yè)、下一頁(yè)的url的設(shè)計(jì)。
<h1 id="title">影片列表</h1>
<hr>
  
<table border="0" width="500">
    
<tr align="right">
    
<td>
    {% if has_previous %}
    
<href="/film/list?page={{ previous }}">上一頁(yè)</a>
    {% endif %} {% if has_next %}
    
<href="/film/list?page={{ next }}">下一頁(yè)</a>
    {% endif %}
    
</td>
    
</tr>
  
</table>
<table border="1" width="500">
<tr>
  
<th>片名</th>
  
<th>演員</th>
  
<th>發(fā)行商</th>
  
<th>發(fā)行日期</th>
  
<th>簡(jiǎn)介</th>
</tr>
{% for film in object_list %}
<tr>
  
<td>{{ film.title }}</td>
  
<td>
  {% for actor in film.actors.all %}
  {{ actor }}
<br>
  {% endfor %}
  
</td>
  
<td>{{ film.publisher }}</td>
  
<td>{{ film.pub_date }}</td>
  
<td>{{ film.intro }}</td>
</tr>
{% endfor %}
</table>

3、完成,測(cè)試。