django-bs

Bootstrap integration for django using widget templates
git clone https://git.ce9e.org/django-bs.git

NameSize
.github/workflows/main.yml593B
CHANGES.md1931B
LICENSE1072B
README.md3070B
django_bs/__init__.py751B
django_bs/templates/bs/field.html1454B
django_bs/templates/bs/form.html297B
django_bs/templates/bs/messages.html168B
django_bs/templates/bs/pagination.html1220B
django_bs/templates/django/forms/default.html82B
django_bs/templates/django/forms/div.html83B
django_bs/templates/django/forms/field.html103B
django_bs/templates/django/forms/widgets/checkbox.html209B
django_bs/templates/django/forms/widgets/checkbox_option.html299B
django_bs/templates/django/forms/widgets/clearable_file_input.html602B
django_bs/templates/django/forms/widgets/input.html205B
django_bs/templates/django/forms/widgets/multiple_input.html176B
django_bs/templates/django/forms/widgets/multiwidget.html185B
django_bs/templates/django/forms/widgets/radio_option.html58B
django_bs/templates/django/forms/widgets/select.html493B
django_bs/templates/django/forms/widgets/textarea.html161B
django_bs/templatetags/__init__.py0B
django_bs/templatetags/bootstrap.py3522B
example/__init__.py0B
example/forms.py1264B
example/manage.py208B
example/settings.py1675B
example/templates/form.html814B
example/urls.py125B
example/views.py344B
pyproject.toml617B

Bootstrap forms for Django

Bootstrap integration for django using widget templates.

Motivation

This library is meant to be a drop-in replacement for django-bootstrap5. See below for a list of differences. I really like that library, but it is hard to customize some things because everything is done in python functions. By using widget templates, I hope this library is more flexible.

Installation

Install with pip:

pip install 'django-bs==4.*'  # for bootstrap 4
pip install 'django-bs==5.*'  # for bootstrap 5

After that you have to add it to INSTALLED_APPS. You also need to make sure that the correct FORM_RENDERER is selected and django.forms is in INSTALLED_APPS (after django_bs). This is required so that widget templates can be overwritten:

INSTALLED_APPS = [
    …
    'django_bs',
    …
    'django.forms',
    …
]

FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'

Usage

The following template tags are included in the bootstrap library:

Please refer to the source code for additional parameters.

Differences to django-bootstrap5