summaryrefslogtreecommitdiff
path: root/procurement/admin_forms.py
blob: b7bbd1c1ed373a84ffab369e800326c5626b0bf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple

from procurement.models import Supplier, Component


class ComponentAdminForm(forms.ModelForm):
    suppliers = forms.ModelMultipleChoiceField(
        queryset=Supplier.objects.filter(is_authorized=True),
        required=False,
        widget=FilteredSelectMultiple(
            verbose_name='Suppliers',
            is_stacked=False
        )

    )

    class Meta:
        model = Component
        fields = ['name', 'sku', 'suppliers']