How to do search with pagination using Django

You can easily understand which functionality i'm trying to add this pagination

  1. Using option, i want to show limited data like if user select 10 then number of data should display 10
  2. Next, if user enter page number 2 then it go to page number 2


<form class="form-inline" method="GET" action="{% url 'bookings:cancelled_bookings_list' %}">
                                     {% csrf_token %}
                                     <select class="form-control w-50" data-selected="Data" name="no_of_data">
                                      <option value="10">10</option>
                                      <option value="20">20</option>
                                      <option value="30">30</option>
                                     <div class="input-group">
                                         <input type="text" class="form-control w-25" placeholder="Enter Page No" name="page_no">
                                         <div class="input-group-append">
                                             <button class="btn btn-primary" type="submit" id="button-addon2">Go</button>

page = request.GET.get('page', 1)
paginator = Paginator(bookings, PAGE_SIZE)
    bookings =
except PageNotAnInteger:
    bookings =
except EmptyPage:
    bookings =

if request.method == "GET":
    no_of_data = request.GET.get('no_of_data')
    page_no = request.GET.get("page_no")
    paginate_by = no_of_data
Back to Top