code: def paginate(self, klass=Paginator, per_page=None, page=1, *args, **kwargs):
          
  
          self.per_page_options = [25, 50, 100, 200]  # This should probably be a passed in option
  
          self.per_page = per_page = per_page or self._meta.per_page
  
          self.paginator = klass(self.rows, per_page, *args, **kwargs)
          self.page = self.paginator.page(page)
  
          # Calc variables for use in displaying first, adjacent, and last page links
          adjacent_pages = 1  # This should probably be a passed in option
  
          # Starting page (first page between the ellipsis)
          start_page = max(self.page.number - adjacent_pages, 1)
          if start_page <= 3:
              start_page = 1
  
          # Ending page (last page between the ellipsis)
          end_page = self.page.number + adjacent_pages + 1
          if end_page >= self.paginator.num_pages - 1:
              end_page = self.paginator.num_pages + 1
  
          # Paging vars used in template
          self.page_numbers = [n for n in range(start_page, end_page) if 0 < n <= self.paginator.num_pages]
          self.show_first = 1 not in self.page_numbers
          self.show_last = self.paginator.num_pages not in self.page_numbers
docs: Paginates the table using a paginator and creates a ``page`` property
          containing information for the current page.
  
          :type     klass: Paginator class
          :param    klass: a paginator class to paginate the results
          :type  per_page: `int`
          :param per_page: how many records are displayed on each page
          :type      page: `int`
          :param     page: which page should be displayed.
  
          Extra arguments are passed to the paginator.
  
          Pagination exceptions (`~django.core.paginator.EmptyPage` and
          `~django.core.paginator.PageNotAnInteger`) may be raised from this
          method and should be handled by the caller.