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',
}
from django import forms
from .models import Invoice_customer_list,Invoice_product_list
# Form for the Invoice model
class Invoice_customer_Form(forms.ModelForm):
class Meta:
model = Invoice_customer_list
fields = ['customer']
labels = {
'customer': 'Select Customer',
}
class Invoice_product_form(forms.ModelForm):
class Meta:
model = Invoice_product_list
fields = ['product']
labels = {
'product':'Select Product'
}
i want to createa form like this here is updated code