'Regression test for #13902: When using a ManyToMany in list_filter,
results shouldn\'t apper more than once. With an intermediate model.'

def test_distinct_for_through_m2m_in_list_filter(self):

    lead = Musician.objects.create(name=u'Vox')
    band = Group.objects.create(name=u'The    Hype')
    Membership.objects.create(group=band, music=lead, role=u'lead    voice')
    Membership.objects.create(group=band, music=lead, role=u'bass    player')
    m = GroupAdmin(Group, admin.site)
    request = self.factory.get(u'/group/', data={u'members': lead.pk})
    cl = ChangeList(request, Group, 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)
    cl.get_results(request)
    self.assertEqual(cl.result_count, 1)
