I want to set class of OrderingFilter's in Django framework. I can add class to ModelChoiceFilter like that:
from django_filters import OrderingFilter, ModelChoiceFilter
user_status_filter = ModelChoiceFilter(queryset=UserStatus.objects.all(),
label="Status",
widget=Select(attrs={'class': 'form-control'}))
But adding class to OrderingFilter results in error: 'ChoiceExactField.widget' must be a widget class, not <django.forms.widgets.Select object at 0x000001FA0C6BCA48>'
order_by_filter = OrderingFilter(
fields=(
('score', 'Score'),
('money', 'Money'),
),
label="Sort by",
widget=Select(attrs={'class': 'form-control'})
)
What is the proper solution to set class of this widget?