Skip to content

Commit

Permalink
Merge pull request #404 from the5fire/fix-list-make-result-useless-query
Browse files Browse the repository at this point in the history
优化xadmin list页面query
  • Loading branch information
wgbbiao authored May 23, 2017
2 parents c7a5861 + 0573002 commit 673d7cc
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions xadmin/views/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,6 @@ def make_result_list(self):
# Get the number of objects, with admin filters applied.
self.result_count = self.paginator.count

# Get the total number of objects, with no admin filters applied.
# Perform a slight optimization: Check to see whether any filters were
# given. If not, use paginator.hits to calculate the number of objects,
# because we've already done paginator.hits and the value is cached.
if not self.list_queryset.query.where:
self.full_result_count = self.result_count
else:
self.full_result_count = self.base_queryset.count()

self.can_show_all = self.result_count <= self.list_max_show_all
self.multi_page = self.result_count > self.list_per_page

Expand Down

0 comments on commit 673d7cc

Please sign in to comment.