# Defaulting ALL booleans to checkboxes in model forms

**URL:** <https://forum.djangoproject.com/t/defaulting-all-booleans-to-checkboxes-in-model-forms/9397>\
**Category:** Using Django\
**Created:** [August 25, 2021, 7:42pm UTC](https://forum.djangoproject.com/t/defaulting-all-booleans-to-checkboxes-in-model-forms/9397 "2021-08-25T19:42:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![logikonabstractions](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/logikonabstractions/32/4066_2.png) [@logikonabstractions](https://forum.djangoproject.com/u/logikonabstractions)\
**Post date:** [August 25, 2021, 7:42pm UTC](https://forum.djangoproject.com/t/defaulting-all-booleans-to-checkboxes-in-model-forms/9397/1 "2021-08-25T19:42:12Z")

</div>

Hey,

So I have a bunch of form created (model forms), and now it looks like we want checkboxes for all after all. Oups.

So I know I can use the `widgets = {'fieldname':CheckboxInput()}` (explicitly specify the fields in the form definition). However that’s quite a number of fields to specify this way, only to turn them into the oh-so-desired checkboxes.

Is there anyway in a django project to set CheckboxInput as the default display for all the Boolean fields in my models that end up in a form? Most of my forms are ModelForms, if that helps. Or I guess more generally, override the default input type for a given model field type in a project.

A second best option would be to be able to specify the input at the Model level for my booleans fields - that would make for quicker find & replace in my models, easier to check, and also some fields end up in more than one form so that would still cut things down to a more manageable and less irritating piece of work…

Thanks.

---

<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:** [August 25, 2021, 8:41pm UTC](https://forum.djangoproject.com/t/defaulting-all-booleans-to-checkboxes-in-model-forms/9397/2 "2021-08-25T20:41:55Z")

</div>

According to [Form fields | Django documentation | Django](https://docs.djangoproject.com/en/3.0/ref/forms/fields/#booleanfield), the default for a BooleanField _is_ a checkbox. What is making you think otherwise?

---

<div class="post-metadata">

**Author:** ![logikonabstractions](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/logikonabstractions/32/4066_2.png) [@logikonabstractions](https://forum.djangoproject.com/u/logikonabstractions)\
**Post date:** [August 25, 2021, 9:59pm UTC](https://forum.djangoproject.com/t/defaulting-all-booleans-to-checkboxes-in-model-forms/9397/3 "2021-08-25T21:59:28Z")

</div>

The fact that most of the data I had to import had missing info, so I had imported it allowing null=True.

Thus in that case the default isn’t apparently a checkbox, but a dropdown (to allow for the unknown/missing data).

A bit of a facepalm on that I guess.

---

<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:** [August 25, 2021, 10:05pm UTC](https://forum.djangoproject.com/t/defaulting-all-booleans-to-checkboxes-in-model-forms/9397/4 "2021-08-25T22:05:25Z")

</div>

Yes, a [NullBooleanField](https://docs.djangoproject.com/en/3.2/ref/forms/fields/#nullbooleanfield) is different.
