Files
depot_django/payments/forms.py
T
gitea 4603953458 fixed crud list
fixed payments
upload -a
2025-07-23 11:08:25 +03:00

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})"