Skip to content

django crispy forms

The best way to have DRY Django forms.

pip install django-crispy-forms crispy-bootstrap5
# myproject/settings.py
INSTALLED_APPS = [
    ...
    'crispy_forms',
    'crispy_bootstrap5',
    ...
]

CRISPY_TEMPLATE_PACK = 'bootstrap5'  # You can choose 'bootstrap4', 'bootstrap5', 'uni_form', etc.
# example
# Path to custom crispy-forms template pack
CRISPY_TEMPLATE_PACK = 'crispy-tailwind'

# Allow the use of our custom template pack
CRISPY_ALLOWED_TEMPLATE_PACKS = ('bootstrap4', 'crispy-tailwind')

Reference