text: How to add Pagination in Django Project?
  Pagination system is one of the most common features in blogs, search engine , list of result etc. Seeing the popularity of pagination system django developers have build a Paginator class so that web developers do not have to think of the logic to make paginators.
  Paginator Class live in django/core/paginator.py . So to use Paginator Class we first need to import it from django.core.paginator
  from django.core.paginator import Paginator
  Syntax :
  p = Paginator(list_of_objects, no_of_objects_per_page)
  The first argument is the list of objects which will be distributed over pages. The second argument denotes the number of objects that will be displayed on each page. These two arguments are required.
  However Paginator Class takes two more optional arguments which are listed below –
  - orphans – its value must be an integer less than the no_of_objects_per_page value. It tells if the last page has minimum number of objects. If the number of remaining objects in the last page is less than or equal to the value of this argument then those objects will be added to the previous page. Default value is 0.
  - allow_empty_first_page – It takes Boolean values. Whether or not the first page is allowed to be empty.
  Note : the first argument need not to be a list. Instead it can be a tuple, queryset or other sliceable object with a count() or __len__() method.
  How to use Paginator Class?
  Suppose we are developing a blogging website. We have defined Post model in models.py and we have creates 8 such posts. Now in views.py, we have written the following code –
  Python3
  At the third line , Paginator Class is imported. In the index function we have constructed a paginator object called p . This paginator creates page objects. Each Page object will have equal number of post objects. Then we retrieved the desired page number from the query parameter ‘page’ from a GET request. This page number is used to extract the correct page object.
  Now in index.html –
  HTML
  Result :
  In the image we have send the value of the page number with a GET request ( denoted with rectangle). You can see the pagination in the bottom of the image ( marked with rectangle ).
  Here is another image of the last page –
  Methods :
  Attributes :
  However, as Paginator class uses Page class to distribute objects, It will be better if we know more about the Page Class.
  Page Class :
  Generally Page object is used in Paginator Class. You rarely have to construct it manually.
  Syntax :
  page = Page( object_list , number, paginator)
  Here object list is the list of objects , number argument is used to number the Page object. Paginator is the Paginator objects for whom this page object is constructed.
  Attributes :
  Methods :