[Django] #22810: full_result_count optimization is wrong in the presence of custom ListFilters

15 views
Skip to first unread message

Django

unread,
Jun 11, 2014, 11:26:17 AM6/11/14
to django-...@googlegroups.com
#22810: full_result_count optimization is wrong in the presence of custom
ListFilters
-------------------------------+--------------------
Reporter: gwahl@… | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
ChangeList.get_results performs an optimization when counting the total
number of results, disregarding list filters. It assumes that if there are
no query parameters, the full count is the same as the filtered count.
This is incorrect when a custom list filter does filtering when there are
no query parameters.

In my case, the list filter filters the objects by default, and removes
the filtering with a query parameter. The optimization incorrectly assumes
that there is no filtering by default, so the total result count is wrong.

https://github.com/django/django/blob/master/django/contrib/admin/views/main.py#L172,
see 'Perform a slight optimization'.

--
Ticket URL: <https://code.djangoproject.com/ticket/22810>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 16, 2014, 8:22:29 AM6/16/14
to django-...@googlegroups.com
#22810: full_result_count optimization is wrong in the presence of custom
ListFilters
-------------------------------+------------------------------------
Reporter: gwahl@… | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timo):

* needs_better_patch: => 0
* needs_docs: => 0
* type: Uncategorized => Bug
* needs_tests: => 0
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/22810#comment:1>

Django

unread,
Nov 7, 2015, 8:02:52 AM11/7/15
to django-...@googlegroups.com
#22810: full_result_count optimization is wrong in the presence of custom
ListFilters
-------------------------------+------------------------------------
Reporter: gwahl@… | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by slurms):

PR here: https://github.com/django/django/pull/5576.

--
Ticket URL: <https://code.djangoproject.com/ticket/22810#comment:2>

Django

unread,
Nov 7, 2015, 8:03:08 AM11/7/15
to django-...@googlegroups.com
#22810: full_result_count optimization is wrong in the presence of custom
ListFilters
-------------------------------+------------------------------------
Reporter: gwahl@… | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by slurms):

* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/22810#comment:3>

Django

unread,
Nov 18, 2015, 7:55:02 PM11/18/15
to django-...@googlegroups.com
#22810: full_result_count optimization is wrong in the presence of custom
ListFilters
-------------------------------+------------------------------------
Reporter: gwahl@… | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"5fa7b592b3f43282823045954c61a1f9a4b31a7f" 5fa7b59]:
{{{
#!CommitTicketReference repository=""
revision="5fa7b592b3f43282823045954c61a1f9a4b31a7f"
Fixed #22810 -- Corrected admin changelist count for list filters that
filter by default.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22810#comment:4>

Reply all
Reply to author
Forward
0 new messages