Bootstrap Register Form

Hey,

is there any way to use Bootstrap classes with my Register form template like {{form.username}} so I can just customize the Input Field. I found a Django Addon and tried it but its very bad and not customizable like I want. And if Bootstrap is not able to do that can I change it with some css in any way?

1 Like

I think the easiest approach is to use Django Widget Tweaks. You can use it two change how the input is rederized, for example:

{% render_field form.username class+="form-control form-control-sm" %}

With that your input will use the form-control and form-control-sm, you can add every classes and/or attributes you want.

In addition to @Rigo-Villalta 's answer, you have a couple additional options as well.

  • See the docs on Styling widget instances for the “native Django” way to do this
  • See Crispy Forms as a complete form styling package, of which applying css classes is just one of its many features.