[Answered ]-Django filters – Using an AllValuesFilter (with a LinkWidget) on a ManyToManyField

1👍

Why did you subclass LinkOrderFilterSet?

Maybe the connect way to use it is this:

import django_filters 

class SignFilter(django_filters.FilterSet):  
    operator = django_filters.AllValuesFilter(widget=django_filters.widgets.LinkWidget)  

    class Meta:
        model = Sign
        fields = ['operator']

1👍

You can use this

class CircleFilter(django_filters.FilterSet):
    l = []
    for c in Organisation.objects.all():
        l.append((c.id, c.name))
    operator = django_filters.ChoiceFilter(
        choices=set(l))

class Meta:
    model = Sign
    fields = ['operator']

Leave a comment