I’m going back on this issue, and based on this helpful comment posted on the PR
I guess we could compare
root_queryset.query.wheretopaginator’s queryset where
I think I managed to find a better solution:
The relevant if/else is now this:
if not self.model_admin.show_full_result_count:
full_result_count = None
elif (
self.has_active_filters
or isinstance(self.root_queryset, Manager)
or self.queryset.query.where
):
# Get the total number of objects, with no admin filters applied.
full_result_count = self.root_queryset.count()
else:
# If there are no filters, no need for an extra query.
full_result_count = result_count
The reason for the isinstance check is because on this test the root_queryset is a custom Manager, which doesn’t have a query property, so in that case I’m assuming we need to redo the count. I don’t have the enough knowledge to know if that assumption makes sense.
I also don’t really know if it would be better to compare the root_queryset.query.where to the queryset.query.where rather than a boolean check on the queryset.query.where
Two other tests needed adjustment to adapt to the new query count. I’ve ran the entire suite in my local and everything seems to w
Now, since the original bug was closed as a wontfix, I don’t really know what’s the process to follow. Do I file a new bug or should the existing one be reopened?