4603953458
fixed payments upload -a
19 lines
620 B
Python
19 lines
620 B
Python
from django.forms import ModelForm, CheckboxSelectMultiple
|
|
|
|
from containers.models import Container
|
|
from payments.models import Payment
|
|
|
|
|
|
class PaymentCreateForm(ModelForm):
|
|
class Meta:
|
|
model = Payment
|
|
fields = ['company', 'total_amount', 'description']
|
|
widgets = {
|
|
'containers': CheckboxSelectMultiple(),
|
|
}
|
|
|
|
|
|
# def __init__(self, *args, **kwargs):
|
|
# super().__init__(*args, **kwargs)
|
|
# self.fields['containers'].queryset = Container.objects.all()
|
|
# self.fields['containers'].label_from_instance = lambda obj: f"{obj.name} ({obj.company.name})" |