Commit da828390 authored by Paul Brown's avatar Paul Brown

simplify pagination formula

parent 7aeec0e0
...@@ -3,6 +3,7 @@ import re ...@@ -3,6 +3,7 @@ import re
import csv import csv
import mimetypes import mimetypes
import time import time
from math import ceil
from werkzeug import secure_filename from werkzeug import secure_filename
...@@ -1818,9 +1819,7 @@ class BaseModelView(BaseView, ActionsMixin): ...@@ -1818,9 +1819,7 @@ class BaseModelView(BaseView, ActionsMixin):
# Calculate number of pages # Calculate number of pages
if count is not None and self.page_size: if count is not None and self.page_size:
num_pages = count // self.page_size num_pages = int(ceil(count / float(self.page_size)))
if count % self.page_size != 0:
num_pages += 1
else: else:
num_pages = None num_pages = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment