# Bootstrap Accordion in Django Forms

**URL:** <https://forum.djangoproject.com/t/bootstrap-accordion-in-django-forms/8671>\
**Category:** Using Django\
**Created:** [July 8, 2021, 3:23am UTC](https://forum.djangoproject.com/t/bootstrap-accordion-in-django-forms/8671 "2021-07-08T03:23:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfones](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mfones/32/5034_2.png) [@mfones](https://forum.djangoproject.com/u/mfones)\
**Post date:** [July 8, 2021, 3:23am UTC](https://forum.djangoproject.com/t/bootstrap-accordion-in-django-forms/8671/1 "2021-07-08T03:23:27Z")

</div>

Anyone have experience adding a [boostrap accordion](https://getbootstrap.com/docs/5.0/components/accordion/) inside a Django form?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 8, 2021, 11:39am UTC](https://forum.djangoproject.com/t/bootstrap-accordion-in-django-forms/8671/2 "2021-07-08T11:39:02Z")

</div>

We use bootstrap in our projects, but not that widget. Do you have a specific question or issue?

---

<div class="post-metadata">

**Author:** ![mfones](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mfones/32/5034_2.png) [@mfones](https://forum.djangoproject.com/u/mfones)\
**Post date:** [July 8, 2021, 12:58pm UTC](https://forum.djangoproject.com/t/bootstrap-accordion-in-django-forms/8671/3 "2021-07-08T12:58:23Z")

</div>

The project I have is mobile first. Users have many items in lists to pick from and the accordion will work well for this application. I understand that if your not using `{{ form }}` then Django’s form checking will not be uses. Is this correct? I would like to implement form error checking. Can the individual form elements be access inside the form with error checking? For example will `{{ form.first_name }}` set up as a required filed be flagged with an error in the form if it’s required and not filled out?  
What widgets do you use for an expanding/contacting list in your projects?  
Also, is crispy forms necessary to implement bootstrap? I have used it some tutorial projects but I don’t see why its needed if you install/CDN boostrap in your project.

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 8, 2021, 1:14pm UTC](https://forum.djangoproject.com/t/bootstrap-accordion-in-django-forms/8671/4 "2021-07-08T13:14:22Z")

</div>

> [@mfones](#):
>
> I understand that if your not using {{ form }} then Django’s form checking will not be uses. Is this correct?

Before I say that this is not correct, I’d like to know where you saw that as being true. (There might be some additional context behind that statement making it true under some specific circumstance.) In general terms, no, that’s not an accurate statement.

The use of `{{ form }}` or `{{ form.field }}` is something done at the time the form is rendered. Form error checking occurs in the server after the form has been POSTed - with the possibility that there is some JavaScript attached to the page allowing for some “pre-screening” or “pre-validation” before the form is submitted.  
However, regardless of what happens in the client, the server must _always_ validate submitted data - you must not rely only upon any form of browser-based validation, because it’s too easily bypassed.

> [@mfones](#):
>
> What widgets do you use for an expanding/contacting list in your projects?

We don’t. When we have information that is too big to present on one page, or if we just want to organize or segregate data, we use a “tab” structure.

> [@mfones](#):
>
> Also, is crispy forms necessary to implement bootstrap?

No, it’s not required. (We do use crispy, but not just for implementing bootstrap.) Again, I’m curious to know what you might have read that would give you that impression.

Your pages being rendered _are_ HTML pages. Anything you can do in a generic HTML page can be replicated within a Django template.
