A Django wrapper for the Bootstrap Select library
The full documentation is at https://django-bootstrap-select.readthedocs.io.
Need to render an image in a select box?
Turn this:
Into this:
Install Django Bootstrap Select:
pip install django-bootstrap-select
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'bootstrap_select.apps.BootstrapSelectConfig',
...
)
Using it in a form:
def get_choices():
choices = (('face.jpg', escape('<img src="path-to-face.jpg"/>'),)
return choices
class IconForm(forms.Form):
icon = forms.URLField(widget=BootstrapSelect(choices=get_choices()))
- Renders labels from form choices as custom-content.
- Renders tokens from form choices for live-search.
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
Tools used in rendering this package: