Ticket #11295: admin-count.diff

File admin-count.diff, 1.1 KB (added by Alex Gaynor, 15 years ago)
  • django/contrib/admin/views/main.py

    diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py
    index df0fd9f..8e3d605 100644
    a b class ChangeList(object):  
    104104
    105105        # Get the total number of objects, with no admin filters applied.
    106106        # Perform a slight optimization: Check to see whether any filters were
    107         # given. If not, use paginator.hits to calculate the number of objects,
    108         # because we've already done paginator.hits and the value is cached.
    109         if not self.query_set.query.where:
     107        # given by the user, if any came from ModelAdmin.queryset we don't
     108        # consider those here. If not, use paginator.hits to calculate the
     109        # number of objects, because we've already done paginator.hits and the
     110        # value is cached.
     111        if not set(self.params) - set([ALL_VAR, ORDER_VAR, ORDER_TYPE_VAR, SEARCH_VAR, IS_POPUP_VAR]):
    110112            full_result_count = result_count
    111113        else:
    112114            full_result_count = self.root_query_set.count()
Back to Top