manytomany distinct

1
2
ids = [i['id'] for i in parent.artists.values('id')]
kwargs['queryset'] = Artist.objects.filter(name__icontains=request.GET.get('filter', '')).exclude(id__in=ids)