loading...
Cover image for Crispy Forms In Django.

Crispy Forms In Django.

yahaya_hk profile image Kenny ・1 min read

Crispy forms provide a very neat way of using Bootstrap within our Django templates. For the purpose of this article, we are going to be using bootstrap 4.

The first step is to install crispy form:

pip install django-crispy-forms

Next, go to the settings.py and under installed app, add crispy_forms

Then at the bottom of the settings.py, add

CRISPY_TEMPLATE_PACK = 'bootstrap4'

Lastly, in order to use it, we simplyload the crispy form tag at the top of our template,

{% load crispy_form_tags %}

and wherever you intend to render your form tag, you use the crispy tag as a template tag using the pipe character '|'

{{form | crispy }}

Discussion

pic
Editor guide