django-bootstrap-v5
raw JSON → 1.0.11 verified Fri May 01 auth: no python
Django template tags and filters for Bootstrap 5 integration. Version 1.0.11, released Mar 2023. Low maintenance cadence; supports Bootstrap 5.0–5.3.
pip install django-bootstrap-v5 Common errors
error ModuleNotFoundError: No module named 'django_bootstrap5' ↓
cause Package not installed or not added to INSTALLED_APPS.
fix
pip install django-bootstrap-v5 and add 'django_bootstrap5' to INSTALLED_APPS.
error TemplateSyntaxError: 'bootstrap5' is not a registered tag library. Must be one of: ... ↓
cause Using old {% load bootstrap5 %} syntax.
fix
Change to {% load django_bootstrap5 %}
error django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: django_bootstrap5 ↓
cause Duplicate entry of 'django_bootstrap5' in INSTALLED_APPS or another app with same label.
fix
Remove duplicate INSTALLED_APPS entry.
Warnings
breaking Template tag library name changed from 'bootstrap5' to 'django_bootstrap5' in v1.0.0. Old {% load bootstrap5 %} will raise TemplateSyntaxError. ↓
fix Replace {% load bootstrap5 %} with {% load django_bootstrap5 %} in all templates.
deprecated The 'set_required' and 'set_disabled' filters are deprecated and will be removed in v2.0. ↓
fix Use the 'required' and 'disabled' arguments in form field configuration or Bootstrap form rendering.
gotcha Bootstrap 5 CSS/JS must be included manually in your base template; this library only provides Django template tags, not the frontend assets. ↓
fix Add Bootstrap 5 CSS/JS via CDN or static files in your base HTML (e.g., <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">).
gotcha If Django's SECRET_KEY is not set, the bootstrap5 templatetags may raise a RuntimeError during startup. ↓
fix Ensure SECRET_KEY is set in settings.py.
Install
pip install django-bootstrap-v5==1.0.11 Imports
- bootstrap5 wrong
from bootstrap5 import ...correctfrom django_bootstrap5.templatetags import bootstrap5
Quickstart
# settings.py
INSTALLED_APPS = [
...
'django_bootstrap5',
]
# template.html
{% load django_bootstrap5 %}
<form action="." method="post">
{% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button button_type="submit" content="Submit" %}
</form>