title: Pagination Django Class Based View Not Working Properly
body: <p>I'm trying to use Django (v2.0) pagination with CBV and got issues. The pagination is active because the tag {% if is_paginated %} returns "True" and shows the "PagNav" and the browser path changes too, like this (..?page=1, ...?page=2, etc...) but the displayed elements are all, not 3 just as I set in "paginate_by=3". For example, if the query has 15 elements must to show 3 elements per page and 1 to 5 in the pagination down bellow, but shows all elements. I attach an image and the code:</p>
  
  <p><a href="https://i.stack.imgur.com/A8zRs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A8zRs.png" alt="enter image description here"></a></p>
  
  <p><strong><em>models.py:</em></strong></p>
  
  <pre><code>from django.db import models
  from django.contrib.auth.models import User
  from ckeditor.fields import RichTextField
  
  # Create your models here.
  
  class Project(models.Model):
      user = models.ForeignKey(User, on_delete = models.CASCADE, default=1)
      name = models.CharField(verbose_name='Nombre del proyecto', max_length=200)
      client = models.CharField(verbose_name='Nombre del cliente', max_length=200)
      description = RichTextField(verbose_name='Descripción')
      start = models.DateField(verbose_name='Fecha de Inicio', null=True, blank=True)
      ending = models.DateField(verbose_name='Fecha de Finalización', null=True, blank=True)
      order = models.SmallIntegerField(verbose_name="Orden", default=0)
      created = models.DateTimeField(verbose_name='Fecha de creación', auto_now_add=True)
      updated = models.DateTimeField(verbose_name='Fecha de modificación', auto_now=True)
  
      class Meta:
          verbose_name = 'Proyecto'
          verbose_name_plural = 'Proyectos'
          ordering = ['-start', 'order']
  
      def __str__(self):
          return self.name
  
  class Album(models.Model):
      project = models.ForeignKey(Project, verbose_name='Proyecto relacionado', on_delete = models.CASCADE)
      title = models.CharField(verbose_name='Título de la imagen', max_length=200)
      image = models.ImageField(verbose_name='Imagen', upload_to='portfolio')
      created = models.DateTimeField(verbose_name='Fecha de creación', auto_now_add=True)
      updated = models.DateTimeField(verbose_name='Fecha de modificación', auto_now=True)
  
      class Meta:
          verbose_name = 'Imagen en el album'
          verbose_name_plural = 'Imágenes en el album'
          ordering = ['created']
  
          def __str__(self):
              return self.title
  </code></pre>
  
  <p><strong><em>views.py:</em></strong></p>
  
  <pre><code>@method_decorator(staff_member_required(login_url='login'), name='dispatch')
  class AlbumListView(SingleObjectMixin, ListView):
  
      paginate_by = 3
      template_name = "core/album_list_form.html"
  
  
      def get(self, request, *args, **kwargs):
          self.object = self.get_object(queryset=Project.objects.all())
          return super().get(request, *args, **kwargs)
  
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['project'] = self.object
          return context
  
  
      def get_queryset(self):
          return self.object.album_set.all()
  
  
  @method_decorator(staff_member_required(login_url='login'), name='dispatch')
  class ProjectUpdateView(UpdateView):
  
      model = Project
      template_name = "core/project_update_form.html"
      form_class = ProjectUpdateForm
  
  
      def get_success_url(self):
          return  reverse_lazy('portfolio_update', args=[self.object.id]) + '?ok'
  </code></pre>
  
  <p><strong><em>urls.py:</em></strong></p>
  
  <pre><code>from django.urls import path
  from . import views
  
  from .views import *
  
  urlpatterns = [
      path('', HomePageView.as_view(), name="home"),
      path('album/list/&lt;int:pk&gt;', AlbumListView.as_view(), name="portfolio_list_album"),
      # Update Views
      path('project/update/&lt;int:pk&gt;', ProjectUpdateView.as_view(), name="portfolio_update"),
      .
      .
      .
  </code></pre>
  
  <p><strong><em>album_list_form.html:</em></strong></p>
  
  <pre><code>{% extends "core/base.1.html" %}
  {% load static %}
  {% block title %}Imágenes de {{project.name}}{% endblock %}
  
  {% block content %}
  
      &lt;div class="container"&gt;
          &lt;div class="row mt-5 mb-2 ml-1"&gt;
              &lt;div class="mt-3"&gt;
                  &lt;h2 class="mt-5 mb-0"&gt;&lt;a style="color: #343a40;" href="{% url 'portfolio_update' project.id %}"&gt;{{project.name}}&lt;/a&gt;&lt;/h2&gt;
                  &lt;div class="subheading mb-5"&gt;Imágenes:&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
      &lt;div class="album py-5 bg-light"&gt;
          &lt;div class="container" style="margin-bottom: 2.5rem!important; margin-top: 2.5rem!important;"&gt;
              &lt;div class="row"&gt;
  
                  {% for album in project.album_set.all %}          
  
                          &lt;div class="col-md-4"&gt;
                              &lt;div class="card mb-4 shadow-sm"&gt;
                              &lt;img class="card-img-top border-bottom p-2 p-2 p-2 p-2 bg-light" src="{{album.image.url}}" alt="Card image cap"&gt;
                              &lt;div class="card-body"&gt;
                                  &lt;p class="card-text" title="{{album.title}}" style="color: #343a40;"&gt;&lt;strong&gt;{{album.title|truncatechars:31}}&lt;/strong&gt;&lt;/p&gt;
                                  &lt;div class="d-flex justify-content-between align-items-center"&gt;
                                  &lt;div class="btn-group"&gt;
                                      &lt;button type="button" class="btn btn-sm btn-outline-warning"&gt;&lt;i class="fa fa fa-pencil"&gt;&lt;/i&gt;&lt;/button&gt;
                                      &lt;button type="button" class="btn btn-sm btn-outline-danger"&gt;&lt;i class="fa fa fa-times"&gt;&lt;/i&gt;&lt;/button&gt;    
                                  &lt;/div&gt;
                                  &lt;p&gt;&lt;/p&gt;
  
                                  &lt;/div&gt;
                                  &lt;small class="text-muted"&gt;Última modificación: {{album.updated|date:"SHORT_DATE_FORMAT"}} {{album.updated|time:"h:i a"}}&lt;/small&gt;
                              &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;           
  
                  {% endfor %}
              &lt;/div&gt;
  
  
          &lt;/div&gt;
  
              {% if is_paginated %}
  
                  &lt;nav aria-label="Page navigation example"&gt;
                      &lt;ul class="pagination pagination-lg justify-content-center"&gt;
  
                          {% if page_obj.has_previous %}
                              &lt;li class="page-item"&gt;
                                  &lt;a class="page-link" style="color:#bd5d38;" href="?page={{ page_obj.previous_page_number }}" aria-label="Previous"&gt;
                                      &lt;span aria-hidden="true"&gt;&amp;laquo;&lt;/span&gt;
                                      &lt;span class="sr-only"&gt;Previous&lt;/span&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                          {% endif %}
  
                          {% for i in paginator.page_range %}
                              {% if page_obj.number == i %}
                                  &lt;li class="page-item"&gt;&lt;a class="page-link" style="color:#ffffff; background-color: #343a40;" href="?page={{ i }}"&gt;{{ i }}&lt;/a&gt;&lt;/li&gt;
                              {% else %}
                                  &lt;li class="page-item"&gt;&lt;a class="page-link" style="color:#bd5d38;" href="?page={{ i }}"&gt;{{ i }}&lt;/a&gt;&lt;/li&gt;
                              {% endif %}
                          {% endfor %}
  
                          {% if page_obj.has_next %}
                              &lt;li class="page-item"&gt;
                                  &lt;a class="page-link" style="color:#bd5d38;" href="?page={{ page_obj.next_page_number }}" aria-label="Next"&gt;
                                  &lt;span aria-hidden="true"&gt;&amp;raquo;&lt;/span&gt;
                                  &lt;span class="sr-only"&gt;Next&lt;/span&gt;
                                  &lt;/a&gt;
                              &lt;/li&gt;
                          {% endif %}
  
                      &lt;/ul&gt;
                  &lt;/nav&gt;
  
              {% endif %}
  
      &lt;/div&gt;
  
  {% endblock %}
  </code></pre>