class BrandFilterForm(forms.Form):
""" BrandFilterForm - form for brand filtering """
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
name = [(brand.id, brand.name) for brand in Brand.objects.all()]
brand.insert(0, (0, "Всі"))
self.fields['name'].choices = name
name = forms.ChoiceField(label=_('Name'), required=False,
widget=forms.Select(attrs={"onChange": 'submit()'}))```