An app for creating bootstrap components on python level
Project description
django-bootstrap-swt - An app for creating bootstrap components on python level
django-bootstrap-swt simplifies the task of building HTML pages with bootstrap components by using the java swt concept. This reduces your html code duplication, cause you can use predefined bootstrap components.
- Available on pypi as django-bootstrap-swt
- Documentation on readthedocs.org
- Bug tracker
Features:
- Create any bootstrap component on backend level
- Creates uniq id's for bootstrap components like accordion and modal to avoid id conflicts in javascript.
Example
Start by adding django_bootstrap_swt
to your INSTALLED_APPS
setting like this:
INSTALLED_APPS = (
...,
"django_bootstrap_swt",
)
Creating a bootstrap component is as simple as:
item_list = [ListGroupItem(left='text-at-the-left', center='text-at-the-center', right='text-at-the-right')
list_group = ListGroup(items=item_list)
my_modal = Modal(title=f'Details of {self.object.title}',
modal_body=list_group,
btn_value='Open modal',
btn_color=ButtonColorEnum.SECONDARY,
btn_tooltip='Click this button to open modal',
size=ModalSizeEnum.LARGE,)
All django-bootstrap-swt components returns the rendered template as string
. So you can simply concatenate the components:
accordion_title = python_object.str_attribute + Badge(value='123')
If you need a SafeString
instead of string
you can call the render()
function manually:
safe_string = Badge(value='123').render(safe=True)
Check out the documentation for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-bootstrap-swt-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dee4a279f63d2bed500b942bfc05c4c7aa259410d06b3fb5a73fd86a9768ae6 |
|
MD5 | 8dda49677bd6fd6e2e98ba150df5a621 |
|
BLAKE2b-256 | 2fcd28367726a3320b5fb1b3595f23c2fc74a7784fcb7fc92b5c5b693016ce9c |
Hashes for django_bootstrap_swt-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b75182738ddfb4ba4e5193db391b3e30ab8fae0674f66d1a5b473456e021f207 |
|
MD5 | 6374186505d3bcbd3533b1092967fec7 |
|
BLAKE2b-256 | 34aa7d7c27aa7d49214410dc1eb5e88ff6970611928b0c663e007520d6fc8f3c |