'Regressions tests for #15819: If a field listed in search_fields
is a non-unique related object, distinct() must be called.'

def test_distinct_for_non_unique_related_object_in_search_fields(self):

    parent = Parent.objects.create(name=u'Mary')
    Child.objects.create(parent=parent, name=u'Danielle')
    Child.objects.create(parent=parent, name=u'Daniel')
    m = ParentAdmin(Parent, admin.site)
    request = self.factory.get(u'/parent/', data={SEARCH_VAR: u'daniel'})
    cl = ChangeList(request, Parent, m.list_display, m.list_display_links, m.list_filter, m.date_hierarchy, m.search_fields, m.list_select_related, m.list_per_page, m.list_max_show_all, m.list_editable, m)
    self.assertEqual(cl.queryset.count(), 1)
