Skip to content

Commit

Permalink
Merge pull request #422 from JP1125/master
Browse files Browse the repository at this point in the history
FIXED: Use the accurate total number in Pagination, respecting limit() cases
  • Loading branch information
insspb committed Jul 1, 2022
2 parents 2f7eae4 + ff7b728 commit 438d6ef
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions flask_mongoengine/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ def __init__(self, iterable, page, per_page):
self.iterable = iterable
self.page = page
self.per_page = per_page

if isinstance(iterable, QuerySet):
self.total = iterable.count()
else:
self.total = len(iterable)
self.total = len(iterable)

start_index = (page - 1) * per_page
end_index = page * per_page
Expand Down

0 comments on commit 438d6ef

Please sign in to comment.