﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34605	Add distinct support for ListFilters	Karolis Ryselis	nobody	"Current implementation of {{{ChangeList.get_filters()}}} returns may_have_duplicates, which only accounts for field list filters, but not custom list filters where no field is used. One possibility is to add {{{.distinct()}}} in the {{{queryset()}}} method of the filter, but it prevents the objects to be deleted using changelist because {{{.delete()}}} cannot be called after {{{.distinct()}}}. Another approach is to use the approach from {{{ChangeList.get_queryset()}}} - subquery + {{{Exists()}}} in filter's queryset, however, this adds unnecessary complexity on the query if multiple such filters are applied or other filters/search may have duplicates - it would then nest the subqueries, which is suboptimal.

I am not sure about the best solution for this - maybe add method may_have_duplicates on filter spec classes, which defaults to current {{{lookup_needs_distinct}}} call for field filters and raises {{{NotImplementedError}}} for the others?"	Cleanup/optimization	closed	contrib.admin	4.2	Normal	needsinfo			Unreviewed	0	0	0	0	0	0
