crispy-bootstrap5


Namecrispy-bootstrap5 JSON
Version 2024.2 PyPI version JSON
download
home_page
SummaryBootstrap5 template pack for django-crispy-forms
upload_time2024-02-25 08:46:04
maintainer
docs_urlNone
authorDavid Smith
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # crispy-bootstrap5

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smithdc1/crispy-bootstrap5/blob/main/LICENSE)

Bootstrap5 template pack for django-crispy-forms

## Installation

Install this plugin using `pip`:
```bash
$ pip install crispy-bootstrap5
```

## Usage

You will need to update your project's settings file to add ``crispy_forms``
and ``crispy_bootstrap5`` to your projects ``INSTALLED_APPS``. Also set
``bootstrap5`` as and allowed template pack and as the default template pack
for your project

```python
INSTALLED_APPS = (
    ...
    "crispy_forms",
    "crispy_bootstrap5",
    ...
)

CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"

CRISPY_TEMPLATE_PACK = "bootstrap5"
```

## What's new?

Bootstrap 5 introduces [floating labels](https://getbootstrap.com/docs/5.0/forms/floating-labels/).
This template pack include a layout object to use this input type

```python
from crispy_bootstrap5.bootstrap5 import FloatingField

# then in your Layout
... Layout(
    FloatingField("first_name"),
)
```

Accordions also have new features, such as [Accordion flush](https://getbootstrap.com/docs/5.0/components/accordion/#flush) and [Always open](https://getbootstrap.com/docs/5.0/components/accordion/#always-open).
There is a new layout object to use them

```python
from crispy_bootstrap5.bootstrap5 import BS5Accordion

# then in your Layout
# if not informed, flush and always_open default to False
... Layout(
    BS5Accordion(
        AccordionGroup("group name", "form_field_1", "form_field_2"),
        AccordionGroup("another group name", "form_field"),
        flush=True,
        always_open=True
    )
)
```

Support is added for [Switches](https://getbootstrap.com/docs/5.2/forms/checks-radios/#switches). Switches are a custom 
checkbox rendered as a toggle switch. The widget for these fields should be
a [CheckboxInput](https://docs.djangoproject.com/en/4.2/ref/forms/widgets/#django.forms.CheckboxInput).

```python
from crispy_bootstrap5.bootstrap5 import Switch

... Layout(Switch("is_company"))
```


## Development

To contribute to this library, first checkout the code. Then create a new virtual environment:

```bash
cd crispy-bootstrap5
python -mvenv venv
source venv/bin/activate
```

Or if you are using `pipenv`:
```bash
pipenv shell
```

Now install the dependencies and tests:
```bash
pip install -e '.[test]'
```

To run the tests:
```bash
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "crispy-bootstrap5",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "David Smith",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/75/45/af5c7a13742650b1187a1a6db5197577b57f2b1ca3a042c3b386ddfbebfc/crispy-bootstrap5-2024.2.tar.gz",
    "platform": null,
    "description": "# crispy-bootstrap5\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smithdc1/crispy-bootstrap5/blob/main/LICENSE)\n\nBootstrap5 template pack for django-crispy-forms\n\n## Installation\n\nInstall this plugin using `pip`:\n```bash\n$ pip install crispy-bootstrap5\n```\n\n## Usage\n\nYou will need to update your project's settings file to add ``crispy_forms``\nand ``crispy_bootstrap5`` to your projects ``INSTALLED_APPS``. Also set\n``bootstrap5`` as and allowed template pack and as the default template pack\nfor your project\n\n```python\nINSTALLED_APPS = (\n    ...\n    \"crispy_forms\",\n    \"crispy_bootstrap5\",\n    ...\n)\n\nCRISPY_ALLOWED_TEMPLATE_PACKS = \"bootstrap5\"\n\nCRISPY_TEMPLATE_PACK = \"bootstrap5\"\n```\n\n## What's new?\n\nBootstrap 5 introduces [floating labels](https://getbootstrap.com/docs/5.0/forms/floating-labels/).\nThis template pack include a layout object to use this input type\n\n```python\nfrom crispy_bootstrap5.bootstrap5 import FloatingField\n\n# then in your Layout\n... Layout(\n    FloatingField(\"first_name\"),\n)\n```\n\nAccordions also have new features, such as [Accordion flush](https://getbootstrap.com/docs/5.0/components/accordion/#flush) and [Always open](https://getbootstrap.com/docs/5.0/components/accordion/#always-open).\nThere is a new layout object to use them\n\n```python\nfrom crispy_bootstrap5.bootstrap5 import BS5Accordion\n\n# then in your Layout\n# if not informed, flush and always_open default to False\n... Layout(\n    BS5Accordion(\n        AccordionGroup(\"group name\", \"form_field_1\", \"form_field_2\"),\n        AccordionGroup(\"another group name\", \"form_field\"),\n        flush=True,\n        always_open=True\n    )\n)\n```\n\nSupport is added for [Switches](https://getbootstrap.com/docs/5.2/forms/checks-radios/#switches). Switches are a custom \ncheckbox rendered as a toggle switch. The widget for these fields should be\na [CheckboxInput](https://docs.djangoproject.com/en/4.2/ref/forms/widgets/#django.forms.CheckboxInput).\n\n```python\nfrom crispy_bootstrap5.bootstrap5 import Switch\n\n... Layout(Switch(\"is_company\"))\n```\n\n\n## Development\n\nTo contribute to this library, first checkout the code. Then create a new virtual environment:\n\n```bash\ncd crispy-bootstrap5\npython -mvenv venv\nsource venv/bin/activate\n```\n\nOr if you are using `pipenv`:\n```bash\npipenv shell\n```\n\nNow install the dependencies and tests:\n```bash\npip install -e '.[test]'\n```\n\nTo run the tests:\n```bash\npytest\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Bootstrap5 template pack for django-crispy-forms",
    "version": "2024.2",
    "project_urls": {
        "CI": "https://github.com/django-crispy-forms/crispy-bootstrap5/actions",
        "Changelog": "https://github.com/django-crispy-forms/crispy-bootstrap5/releases",
        "Homepage": "https://github.com/django-crispy-forms/crispy-bootstrap5",
        "Issues": "https://github.com/django-crispy-forms/crispy-bootstrap5/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1311a1c22b4c803125901af7d2fa683f4c6eb14d511644da5fc0b45a0cb44cae",
                "md5": "92fc180cf23546d83bcf5c62e9167c63",
                "sha256": "3867e320920a6ef156e94f9e0f06a80344c453e1b3bd96cd9dc0522ae9e9afb8"
            },
            "downloads": -1,
            "filename": "crispy_bootstrap5-2024.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "92fc180cf23546d83bcf5c62e9167c63",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 24351,
            "upload_time": "2024-02-25T08:46:02",
            "upload_time_iso_8601": "2024-02-25T08:46:02.171294Z",
            "url": "https://files.pythonhosted.org/packages/13/11/a1c22b4c803125901af7d2fa683f4c6eb14d511644da5fc0b45a0cb44cae/crispy_bootstrap5-2024.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7545af5c7a13742650b1187a1a6db5197577b57f2b1ca3a042c3b386ddfbebfc",
                "md5": "cdc959eb28cde53c5594b5d225a369fc",
                "sha256": "7d1fa40c6faf472e30e85c72551a3d2c9eedbf0abfff920683315e4e6f670f2b"
            },
            "downloads": -1,
            "filename": "crispy-bootstrap5-2024.2.tar.gz",
            "has_sig": false,
            "md5_digest": "cdc959eb28cde53c5594b5d225a369fc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 23411,
            "upload_time": "2024-02-25T08:46:04",
            "upload_time_iso_8601": "2024-02-25T08:46:04.075937Z",
            "url": "https://files.pythonhosted.org/packages/75/45/af5c7a13742650b1187a1a6db5197577b57f2b1ca3a042c3b386ddfbebfc/crispy-bootstrap5-2024.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-25 08:46:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "django-crispy-forms",
    "github_project": "crispy-bootstrap5",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "crispy-bootstrap5"
}
        
Elapsed time: 3.75656s