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

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.

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-1.0.0.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

django_bootstrap_swt-1.0.0-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-bootstrap-swt-1.0.0.tar.gz
  • Upload date:
  • Size: 27.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.55.1 CPython/3.8.7

File hashes

Hashes for django-bootstrap-swt-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6dee4a279f63d2bed500b942bfc05c4c7aa259410d06b3fb5a73fd86a9768ae6
MD5 8dda49677bd6fd6e2e98ba150df5a621
BLAKE2b-256 2fcd28367726a3320b5fb1b3595f23c2fc74a7784fcb7fc92b5c5b693016ce9c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_bootstrap_swt-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 25.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.55.1 CPython/3.8.7

File hashes

Hashes for django_bootstrap_swt-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b75182738ddfb4ba4e5193db391b3e30ab8fae0674f66d1a5b473456e021f207
MD5 6374186505d3bcbd3533b1092967fec7
BLAKE2b-256 34aa7d7c27aa7d49214410dc1eb5e88ff6970611928b0c663e007520d6fc8f3c

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