Skip to content

Commit 4bcd233

Browse files
committed
Merge pull request pallets-eco#101 from snotling/master
Pagination count() query should remove ORDER BY clause(s)
2 parents 0d2965c + 08f3d4c commit 4bcd233

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flask_sqlalchemy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def paginate(self, page, per_page=20, error_out=True):
385385
items = self.limit(per_page).offset((page - 1) * per_page).all()
386386
if not items and page != 1 and error_out:
387387
abort(404)
388-
return Pagination(self, page, per_page, self.count(), items)
388+
return Pagination(self, page, per_page, self.order_by(None).count(), items)
389389

390390

391391
class _QueryProperty(object):

0 commit comments

Comments
 (0)