Skip to main content

django-bootstrap-swt - An app for creating bootstrap components on python level

Quality Gate Status Coverage Documentation Status PyPI version

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.

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.
  • supports async data fetching for modal and accordion components.

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.

Metadata

Release files for django-bootstrap-swt 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-bootstrap-swt 2.0.1
File Size Uploaded
django-bootstrap-swt-2.0.1.tar.gz 29.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-bootstrap-swt 2.0.1
File Interpreter ABI Platform
django_bootstrap_swt-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 55.6 kB

Release files / django-bootstrap-swt-2.0.1.tar.gz

Download URL django-bootstrap-swt-2.0.1.tar.gz
Size 29.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2df91f75415d6977a52d5a7f46e7dc8effbc24d5977e7a0f655867aeb59c16af
BLAKE2b-256 checksum
How to use checksums
93ed67fa8f287c5a88a48404b24b213ea9b27f2a9b0813709f300eb96d42d713
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

Release files / django_bootstrap_swt-2.0.1-py3-none-any.whl

Download URL django_bootstrap_swt-2.0.1-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
979a095af2e4ce8fa28538073b7810d06de3f826ab297603295ff342dc64d38c
BLAKE2b-256 checksum
How to use checksums
6d5521c72ed4fa4d9a06dc2b59547f652cf853a5614bd07ed20d7cb9cc8b9096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page