title: Django Filter with Pagination
body: <p>I'm attempting to follow the following tutorial for pagination with django filters, but the tutorial seems to be missing something, and i'm unable to get the pagination to show using the function based views method.  </p>
  
  <p><a href="https://simpleisbetterthancomplex.com/tutorial/2016/08/03/how-to-paginate-with-django.html" rel="noreferrer">https://simpleisbetterthancomplex.com/tutorial/2016/08/03/how-to-paginate-with-django.html</a></p>
  
  <pre><code>My updated users_list.html is the following:
  
     {% extends 'base.html' %}
  
  {% load widget_tweaks %}
  
  {% block content %}
    &lt;form method="get"&gt;
      &lt;div class="well"&gt;
        &lt;h4 style="margin-top: 0"&gt;Filter&lt;/h4&gt;
        &lt;div class="row"&gt;
          &lt;div class="form-group col-sm-4 col-md-4"&gt;
            &lt;label/&gt; 3-4 User ID
            {% render_field filter.form.employeentname class="form-control" %}
          &lt;/div&gt;
          &lt;div class="form-group col-sm-4 col-md-4"&gt;
            &lt;label/&gt; First Name
            {% render_field filter.form.employeefirstname class="form-control" %}
          &lt;/div&gt;
          &lt;div class="form-group col-sm-4 col-md-4"&gt;
            &lt;label/&gt; Last Name
            {% render_field filter.form.employeelastname class="form-control" %}
          &lt;/div&gt;
  
          &lt;div class="form-group col-sm-4 col-md-4"&gt;
            &lt;label/&gt; Status
            {% render_field filter.form.statusid class="form-control" %}
          &lt;/div&gt;
  
          &lt;div class="form-group col-sm-4 col-md-4"&gt;
            &lt;label/&gt; Title
            {% render_field filter.form.positiondesc class="form-control" %}
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;button type="submit" class="btn btn-primary"&gt;
          &lt;span class="glyphicon glyphicon-search"&gt;&lt;/span&gt; Search
        &lt;/button&gt;
      &lt;/div&gt;
    &lt;/form&gt;
    &lt;form action = "{% url 'results' %}" form method = "POST"&gt;
          {% csrf_token %}
    &lt;table class="table table-bordered"&gt;
      {{ form.as_table }}
      &lt;thead&gt;
        &lt;tr&gt;
          &lt;th&gt;3-4&lt;/th&gt;
          &lt;th&gt;First name&lt;/th&gt;
          &lt;th&gt;Last name&lt;/th&gt;
          &lt;th&gt;Title&lt;/th&gt;
          &lt;th&gt;Status&lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
  
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        {% for user in filter.qs %}
          &lt;tr&gt;
            &lt;td&gt;{{ user.employeentname }}&lt;/td&gt;
            &lt;td&gt;{{ user.employeefirstname }}&lt;/td&gt;
            &lt;td&gt;{{ user.employeelastname }}&lt;/td&gt;
            &lt;td&gt;{{ user.positiondesc }}&lt;/td&gt;
            &lt;td&gt;{{ user.statusid }}&lt;/td&gt;
            &lt;td&gt;&lt;input type="checkbox" name="usercheck" value = "{{user.employeentname}}" /&gt;&amp;nbsp;&lt;/td&gt;
  
          &lt;/tr&gt;
        {% empty %}
          &lt;tr&gt;
            &lt;td colspan="5"&gt;No data&lt;/td&gt;
          &lt;/tr&gt;
        {% endfor %}
      &lt;/tbody&gt;
    &lt;/table&gt;
  
  
  
            &lt;button class="btn btn-primary" type="submit"&gt;Select User&lt;/button&gt;
          &lt;/form&gt;
  {% endblock %}
  </code></pre>
  
  <p>My view below is based on the tutorial, but i'm using my own model:</p>
  
  <pre><code>def user_list(request):
      user_list = Employee.objects.all()
      user_filter = UserFilter(request.GET, queryset=user_list)
      user_list = user_filter.qs
      page = request.GET.get('page', 1)
  
  
  
      paginator = Paginator(user_list.qs, 10)
      try:
          users = paginator.page(page)
      except PageNotAnInteger:
          users = paginator.page(1)
      except EmptyPage:
          users = paginator.page(paginator.num_pages)
  
  
      args = {'filter':user_filter, 'users':users}
  
  
      return render(request, 'user_list.html', args)
  </code></pre>
  
  <p>My directory structure is setup as the following, perhaps its something with that:</p>
  
  <p><a href="https://i.stack.imgur.com/7aQNA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7aQNA.png" alt="enter image description here"></a></p>
  
  <pre><code>from django import forms
  from .models import Employee
  
  import django_filters
  
  
  class UserFilter(django_filters.FilterSet):
  
  
      class Meta:
          model = Employee
          fields =  ['employeentname', 'employeefirstname', 'employeelastname', 'statusid', 'positiondesc']
  
  
  
  
  
      def __init__(self, *args, **kwargs):
          super(UserFilter, self).__init__(*args, **kwargs)
          # at sturtup user doen't push Submit button, and QueryDict (in data) is empty
          if self.data == {}:
              self.queryset = self.queryset.none()
  </code></pre>
  
  <p>Added my base.html after moving pagination there:</p>
  
  <pre><code>{% load static %}&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet"&gt;
      &lt;!--[if lt IE 9]&gt;
        &lt;script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"&gt;&lt;/script&gt;
        &lt;script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"&gt;&lt;/script&gt;
      &lt;![endif]--&gt;
      &lt;style type="text/css"&gt;
        .page-header {
          margin-top: 0;
        }
      &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
      {% include 'includes/header.html' %}
      &lt;div class="container"&gt;
        {% block content %}
        {% if users.has_other_pages %}
          &lt;ul class="pagination"&gt;
           {% if users.has_previous %}
             &lt;li&gt;&lt;a href="?page={{ users.previous_page_number }}"&gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt;
           {% else %}
            &lt;li class="disabled"&gt;&lt;span&gt;&amp;laquo;&lt;/span&gt;&lt;/li&gt;
         {% endif %}
           {% for i in users.paginator.page_range %}
             {% if users.number == i %}
               &lt;li class="active"&gt;&lt;span&gt;{{ i }} &lt;span class="sr-only"&gt;(current)
            &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
             {% else %}
               &lt;li&gt;&lt;a href="?page={{ i }}"&gt;{{ i }}&lt;/a&gt;&lt;/li&gt;
             {% endif %}
           {% endfor %}
           {% if users.has_next %}
             &lt;li&gt;&lt;a href="?page={{ users.next_page_number }}"&gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt;
           {% else %}
             &lt;li class="disabled"&gt;&lt;span&gt;&amp;raquo;&lt;/span&gt;&lt;/li&gt;
           {% endif %}
         &lt;/ul&gt;
           {% endif %}
        {% endblock %}
      &lt;/div&gt;
      &lt;script src="{% static 'js/jquery-3.1.1.min.js' %}"&gt;&lt;/script&gt;
      &lt;script src="{% static 'js/bootstrap.min.js' %}"&gt;&lt;/script&gt;
  
  
  
  
  
      {% block javascript %}
  
      {% endblock %}
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>What i'm expecting is for my filter to paginate the search results for every 10 users.  What i'm getting now is the entire set of users.  The filter works correctly, it's the pagination that isn't.</p>