crispy-bootstrap5


Namecrispy-bootstrap5 JSON
Version 2024.10 PyPI version JSON
download
home_pageNone
SummaryBootstrap5 template pack for django-crispy-forms
upload_time2024-10-05 12:09:02
maintainerNone
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 -m venv 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": null,
    "name": "crispy-bootstrap5",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "David Smith",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/04/9f/28326c4d35062fdb4ed228c555525da482bbb408cb1c2665a932a5a19880/crispy_bootstrap5-2024.10.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 -m venv 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.10",
    "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": "bf3fbc3bdbda8a6acc1d6b89b63ddd8b82a55a27b5828742716fefca0384e3be",
                "md5": "59370b47cb99aff237212a7d3261a1a1",
                "sha256": "59e91dac5e45a8c954af3fbcaa6804cd5aef4402f027af2f99a352b096c4016f"
            },
            "downloads": -1,
            "filename": "crispy_bootstrap5-2024.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "59370b47cb99aff237212a7d3261a1a1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 24454,
            "upload_time": "2024-10-05T12:09:00",
            "upload_time_iso_8601": "2024-10-05T12:09:00.863147Z",
            "url": "https://files.pythonhosted.org/packages/bf/3f/bc3bdbda8a6acc1d6b89b63ddd8b82a55a27b5828742716fefca0384e3be/crispy_bootstrap5-2024.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "049f28326c4d35062fdb4ed228c555525da482bbb408cb1c2665a932a5a19880",
                "md5": "939cd13ac76b31d5a2619b2139141b19",
                "sha256": "55b442fe675dd95ad280123c7fe464f454186e90b8e5642e751f436c87627c44"
            },
            "downloads": -1,
            "filename": "crispy_bootstrap5-2024.10.tar.gz",
            "has_sig": false,
            "md5_digest": "939cd13ac76b31d5a2619b2139141b19",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 23645,
            "upload_time": "2024-10-05T12:09:02",
            "upload_time_iso_8601": "2024-10-05T12:09:02.347924Z",
            "url": "https://files.pythonhosted.org/packages/04/9f/28326c4d35062fdb4ed228c555525da482bbb408cb1c2665a932a5a19880/crispy_bootstrap5-2024.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-05 12:09:02",
    "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: 1.87881s