Registry / web-framework / crispy-bootstrap5

crispy-bootstrap5

JSON →
library2026.3pypypi✓ verified 24d ago

crispy-bootstrap5 is a Bootstrap 5 template pack for the popular `django-crispy-forms` library. It enables Django forms to be rendered with Bootstrap 5 styles and components, including features like floating labels, accordions, and switches. The library follows a CalVer versioning scheme and releases frequently to keep pace with Django and Bootstrap updates.

pip install crispy-bootstrap5 django-crispy-forms
INSTALL
IMPORT
SIG · CRISPY-BOOTSTRAP5
C
crispy-bootstrap5
web-frameworkpythonv2026.3
Install
3.5s avg
Import
771ms
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2026.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.798s · 66.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.5s · import 0.744s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FormHelper
from crispy_forms.helper import FormHelper
Used to programmatically define form rendering behavior.
Layout
from crispy_forms.layout import Layout
Base class for defining form layouts. Other layout objects like Row, Column, Submit are also commonly imported from crispy_forms.layout.
FloatingField
from crispy_bootstrap5.bootstrap5 import FloatingField
A layout object for Bootstrap 5's floating labels. Other Bootstrap 5 specific layout objects like BS5Accordion and Switch are also imported from this module.
render_crispy_form
from crispy_forms.utils import render_crispy_form
Used to render a crispy form within Python code, for example in a Django view to return an AJAX response. Remember to pass the CSRF token via context if needed.

After installation, add `crispy_forms` and `crispy_bootstrap5` to `INSTALLED_APPS` in your `settings.py`. Then, configure `CRISPY_ALLOWED_TEMPLATE_PACKS` and `CRISPY_TEMPLATE_PACK` to 'bootstrap5'. In your Django template, load `crispy_forms_tags` and render your form using either `{{ form|crispy }}` for basic styling or `{% crispy form %}` if you've defined a `FormHelper` in your form class for advanced layout control.

# settings.py INSTALLED_APPS = [ # ... 'crispy_forms', 'crispy_bootstrap5', # ... ] CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" CRISPY_TEMPLATE_PACK = 'bootstrap5' # forms.py (example form) from django import forms from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Submit class ContactForm(forms.Form): name = forms.CharField(label='Your Name', max_length=100) email = forms.EmailField(label='Your Email') message = forms.CharField(label='Your Message', widget=forms.Textarea) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.layout = Layout( 'name', 'email', 'message', Submit('submit', 'Submit', css_class='btn btn-primary') ) # views.py (example view) from django.shortcuts import render from .forms import ContactForm def contact_view(request): form = ContactForm() return render(request, 'contact.html', {'form': form}) # templates/contact.html {% load crispy_forms_tags %} <form method="post"> {% csrf_token %} {% crispy form %} </form>
Debug
Known issues
breakingMajor versions frequently drop support for older Django and Python versions. Always check release notes before upgrading. For instance, version 2026.3 dropped support for Django 4.2, 5.0, 5.1 and Python 3.8, 3.9, while adding support for Django 6.0 and Python 3.14.
fix
Consult the release notes for the version you are upgrading to and ensure your Django and Python environment matches the supported ranges. Upgrade Django/Python if necessary.
affects: All versions (check release notes)
breakingSupport for `django-crispy-forms` 2.2 and earlier was dropped in version 2024.10 of `crispy-bootstrap5`.
fix
Ensure you are using `django-crispy-forms` version 2.3 or higher when upgrading to `crispy-bootstrap5` 2024.10 or newer.
affects: 2024.10+
gotchaFor Django 5.2 and newer, templates were updated to include `aria-describedby` for `<fieldset>` elements and a parent `<div>` for errors, improving accessibility. Older versions might not be fully accessible or compatible with Django 5.2's expectations without these changes.
fix
Upgrade to `crispy-bootstrap5` 2025.4 or newer to ensure full accessibility and compatibility with Django 5.2's updated form rendering.
affects: Pre-2025.4 with Django 5.2+
gotchaWhen using `FormHelper` to define complex layouts in your form, you should use the `{% crispy form %}` template tag instead of the `{{ form|crispy }}` filter. The filter provides basic rendering, similar to `as_p`, `as_ul`, or `as_table`, and does not allow for layout customization defined in `FormHelper`.
fix
If you are customizing your form layout using `FormHelper`, always use `{% crispy form %}` in your templates. Use `{{ form|crispy }}` for simple forms without custom layouts.
affects: All versions
deprecatedPre-CalVer versions (0.x) used a different versioning scheme and may not receive updates or support. The project switched to CalVer (YYYY.Minor) with version 2023.10.
fix
It is highly recommended to upgrade to a CalVer version (2023.10 or newer) to ensure you receive ongoing support and updates.
affects: < 2023.10
Upgrade
Version history
2026.3latest on PyPI · released Mar 1, 2026
Audit
Dependencies
djangorequiredcrispy-bootstrap5 is a Django app and requires Django to function.
django-crispy-formsrequiredcrispy-bootstrap5 is a template pack for django-crispy-forms and requires it to render forms.
Agent activity
8 hits · last 30 days
node
6
Resources
crispy-bootstrap5 — pip install crispy-bootstrap5 · libregistry