How to apply the two dropdown selectors in django

form.py:

from django import forms from .models import Invoice, InvoiceItem

# Form for the Invoice model
class InvoiceForm(forms.ModelForm):
    class Meta:
        model = Invoice
        fields = ['customer']
        labels = {
            'customer': 'Select Customer',
            # 'total_amount': 'Total Amount',
        }

this above core is create a field to choose the customer at the time of bill creation but also i want to add the new field for the product adding in that product field i want to select the product which are present in the product list

but whenever i am trying to add one more field in this form for the implementation of this functionality its showing me error please any one can help me to solve this and tell me what is the issue whay am i getting this error??

i am expection to add the input dropdown in the invoice app for the invoice creation

Add an extra form field. I.e.:

class InvoiceForm(forms.ModelForm):
    total_amount = forms.DecimalField(label='Total Amount')
    class Meta:
        model = Invoice
        fields = ['customer']
        labels = {
            'customer': 'Select Customer',
        }
Вернуться на верх