summaryrefslogtreecommitdiff
path: root/procurement/admin_forms.py
blob: 018377e60768f88857bcd7345a4d21c484daadef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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']