Skip to main content

An app for creating bootstrap components on python level

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-bootstrap-swt-2.0.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

django_bootstrap_swt-2.0.0-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file django-bootstrap-swt-2.0.0.tar.gz.

File metadata

  • Download URL: django-bootstrap-swt-2.0.0.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-bootstrap-swt-2.0.0.tar.gz
Algorithm Hash digest
SHA256 096efe423f8d74039ceff1dee5f45f1f4d8818a534c74b2f00af76a940f91615
MD5 1cecaf1b1ba3a0bb81709da610d68fe1
BLAKE2b-256 4014be145a820125f59e51055de347adf4fcecafda0441a07484e1cec92355f2

See more details on using hashes here.

File details

Details for the file django_bootstrap_swt-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: django_bootstrap_swt-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for django_bootstrap_swt-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0342f751c273dda6b9e7ed2ac82054867cfdb9484290d813e0c49d46bb205c2
MD5 5714ac30f7a0fc98b99e87e474ebe235
BLAKE2b-256 61ced6857d199d61ba314a91e389082c9d4917b9835031101dc3a896bf34e263

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page