Skip to content

Commit

Permalink
#217 Fix failing pagination test
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed Feb 1, 2021
1 parent 004bf37 commit 029129e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/django_elasticsearch_dsl_drf/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class GetCountMixin:

def get_count(self, es_response):
def get_es_count(self, es_response):
if isinstance(es_response.hits.total, AttrDict):
return es_response.hits.total.value
return es_response.hits.total
Expand All @@ -44,7 +44,7 @@ class Page(django_paginator.Page, GetCountMixin):

def __init__(self, object_list, number, paginator, facets):
self.facets = facets
self.count = self.get_count(object_list)
self.count = self.get_es_count(object_list)
super(Page, self).__init__(object_list, number, paginator)


Expand Down Expand Up @@ -268,7 +268,7 @@ def paginate_queryset(self, queryset, request, view=None):
resp = queryset[self.offset:self.offset + self.limit].execute()
self.facets = getattr(resp, 'aggregations', None)

self.count = self.get_count(resp)
self.count = self.get_es_count(resp)

if self.count > self.limit and self.template is not None:
self.display_page_controls = True
Expand Down

0 comments on commit 029129e

Please sign in to comment.