Group input in forms
I have a django form
class CustomerForm(forms.Form):
first_name = forms.CharField(label=_('Nome'), max_length=30)
last_name = forms.CharField(label=_('Cognome'), max_length=30)
business_name = forms.CharField(label=_('Ragione Sociale'),
max_length=100)
vat_number = forms.CharField(label=_('Partita iva'),
max_length=11, required=False)
and I want to group the inputs (first_name and last_name, business_name and vat_number) so that when the form is displayed I get the first_name and last_name in the div and business_name and vat_number in the other div
Is it possible?
Thank:)
+2
source to share
2 answers
take a look at the Stacked / Grouped Forms snippet where you can define "Stacks" (Groups) of fields in your form.
+1
source to share