Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split form into tabs in Django

I'm developing a Django app which has database driven form fields. I've followed this guide which seems to work so far.

I'm using Twitter Bootstrap and would like to split my fields into tabs. What would be the Django way to do this? Should I append the group label to the id of the form fields and somehow do the magic in the template? Should I use multiple forms in the same view (seems complicated)?

The end result HTML wise is to enclose the input fields in the correct div elements with the group's id like so.

like image 677
netterdotter Avatar asked Dec 03 '25 18:12

netterdotter


1 Answers

I recently required the very same thing.

After some research, I used django-crispy-forms, which worked quite well. A more detailed instructions about the tabs (and the need of .js file for animation) can be found here, in the 'tabs' section.

like image 181
ellimilial Avatar answered Dec 06 '25 09:12

ellimilial



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!