title: How to use pagination in class-based generic views?
body: <p>I try to implement pagination to class-based generic view and in way I did it, it's not works.</p>
  
  <p>urls</p>
  
  <pre><code>url(r'^cat/(?P&lt;category&gt;[\w+\s]*)/page(?P&lt;page&gt;[0-9]+)/$',
      CategorizedPostsView.as_view(), {'paginate_by': 3}),
  </code></pre>
  
  <p>view</p>
  
  <pre><code>class CategorizedPostsView(ListView):
      template_name = 'categorizedposts.djhtml'
      context_object_name = 'post_list'
  
      def get_queryset(self):
          cat = unquote(self.kwargs['category'])
          category = get_object_or_404(ParentCategory, category=cat)
          return category.postpages_set.all()
  </code></pre>
  
  <p>template</p>
  
  <pre><code>&lt;div class="pagination"&gt;
      &lt;span class="step-links"&gt;
          {% if post_list.has_previous %}
              &lt;a href="?page={{ post_list.previous_page_number }}"&gt;previous&lt;/a&gt;
          {% endif %}
  
          &lt;span class="current"&gt;
              Page {{ post_list.number }} of {{ post_list.paginator.num_pages }}.
          &lt;/span&gt;
  
          {% if post_list.has_next %}
              &lt;a href="?page={{ post_list.next_page_number }}"&gt;next&lt;/a&gt;
          {% endif %}
      &lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I try to get the http:// 127.0.0.1:8000/cat/category_name/?page=1 or even http:// 127.0.0.1:8000/cat/category_name/ I got 404 exception.</p>
  
  <p>How to use pagination in class-based generic views in right way?</p>