kozlyuk / smartmed

GNU General Public License v3.0
1 stars 0 forks source link

BrandFilterForm #50

Open Arrathilar opened 5 years ago

Arrathilar commented 5 years ago

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()'}))```
Arrathilar commented 5 years ago

і фільтр по products_count теж думаю потрібен буде