from django.forms import ModelForm, CheckboxSelectMultiple

from containers.models import Container
from payments.models import Payment


class PaymentCreateForm(ModelForm):
    class Meta:
        model = Payment
        fields = ['total_amount', 'company', '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})"