Fix TypeError in offset calculation

sentry issue PRETIXEU-ZB
This commit is contained in:
Raphael Michel
2019-03-27 18:12:49 +01:00
parent 3415fd947a
commit 5f15ebc46f

View File

@@ -82,7 +82,10 @@ class OrderSearch(PaginationMixin, ListView):
page = self.kwargs.get(self.page_kwarg) or self.request.GET.get(self.page_kwarg) or 1
limit = self.get_paginate_by(None)
offset = (page - 1) * limit
try:
offset = (int(page) - 1) * limit
except ValueError:
offset = 0
resultids = list(qs.order_by().values_list('id', flat=True)[:201])
if len(resultids) <= 200 and len(resultids) <= offset + limit:
qs = Order.objects.using(settings.DATABASE_REPLICA).filter(