Skip to content

Commit 4609f6e

Browse files
authored
Merge pull request pallets-eco#812 from pallets/CoburnJoe-patch-1
Fixed bug with duplicate results and counting
2 parents 16bcf97 + b7afef5 commit 4609f6e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

flask_sqlalchemy/__init__.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,7 @@ def paginate(self, page=None, per_page=None, error_out=True, max_per_page=None):
498498
if not items and page != 1 and error_out:
499499
abort(404)
500500

501-
# No need to count if we're on the first page and there are fewer
502-
# items than we expected.
503-
if page == 1 and len(items) < per_page:
504-
total = len(items)
505-
else:
506-
total = self.order_by(None).count()
501+
total = self.order_by(None).count()
507502

508503
return Pagination(self, page, per_page, total, items)
509504

0 commit comments

Comments
 (0)