Skip to content

Commit

Permalink
Comment, linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jperson1 committed Nov 3, 2023
1 parent 47eb968 commit 05cc5dd
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions backend/dissemination/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import math

from django.core.exceptions import BadRequest, PermissionDenied
from django.core.paginator import Paginator, EmptyPage
from django.core.paginator import Paginator
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from django.views.generic import View
Expand Down Expand Up @@ -62,13 +62,11 @@ def post(self, request, *args, **kwargs):
)
results_count = results.count()
# Reset page to one if the page number surpasses how many pages there actually are
if (page > math.ceil(results_count / limit)):
if page > math.ceil(results_count / limit):
page = 1

paginator = Paginator(
object_list=results, per_page=limit
)
results = paginator.get_page(page) # List of <limit> objects

paginator = Paginator(object_list=results, per_page=limit)
results = paginator.get_page(page) # List of size <limit> objects
results.adjusted_elided_pages = paginator.get_elided_page_range(
page, on_each_side=1
) # Pagination buttons, adjust ellipses around the current page
Expand Down

0 comments on commit 05cc5dd

Please sign in to comment.