wagtail-cblocks


Namewagtail-cblocks JSON
Version 0.5.1 PyPI version JSON
download
home_pageNone
SummaryCollection of StreamField blocks for Wagtail
upload_time2024-08-09 14:32:47
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords blocks streamfield wagtail
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # wagtail-cblocks

A collection of StreamField blocks to use in Wagtail CMS.

**Warning!** This project is still early on in its development lifecycle. It is
possible for breaking changes to occur between versions until reaching a stable
1.0. Feedback and pull requests are welcome.

## Requirements

wagtail-cblocks requires the following:
- **Python 3** (3.8, 3.9, 3.10, 3.11, 3.12)
- **Django** (4.2 LTS, 5.1)
- **Wagtail** (5.2 LTS, 6.2)

## Installation

1. Install using ``pip``:
   ```shell
   $ pip install wagtail-cblocks
   ```
2. Add ``wagtail_cblocks`` to your ``INSTALLED_APPS`` setting:
   ```python
   INSTALLED_APPS = [
       # ...
       'wagtail_cblocks',
       # ...
   ]
   ```

## Usage

Each block comes with a template made for Bootstrap 5 which is not shipped by
this plugin. If you plan to use them as is, you must have at least the Bootstrap
stylesheet loaded in your base template - refer as needed to the
[Bootstrap documentation](https://getbootstrap.com/).

In waiting for the documentation, here is a sample usage:

```python
from wagtail.admin.edit_handlers import StreamFieldPanel
from wagtail.blocks import StreamBlock
from wagtail.fields import StreamField
from wagtail.models import Page

from wagtail_cblocks.blocks import (
    ButtonBlock,
    ColumnsBlock,
    HeadingBlock,
    ImageBlock,
    ParagraphBlock,
)


class BaseBlock(StreamBlock):
    title_block = HeadingBlock()
    paragraph_block = ParagraphBlock()
    button_block = ButtonBlock()
    image_block = ImageBlock()


class BodyBlock(BaseBlock):
    columns_block = ColumnsBlock(BaseBlock())


class StandardPage(Page):
    body = StreamField(BodyBlock())

    content_panels = Page.content_panels + [
        StreamFieldPanel('body'),
    ]
```

Factories are also provided for some of the blocks to ease tests - see
[`wagtail_cblocks/factories.py`](wagtail_cblocks/factories.py). To make use of
them, install the extra *factories* requirements:

```shell
$ pip install wagtail-cblocks[factories]
```

## Development
### Quick start

To set up a development environment, ensure that Python 3 is installed on your
system. Then:

1. Clone this repository
2. Create a virtual environment and activate it:
   ```shell
   $ python3 -m venv venv
   $ source venv/bin/activate
   ```
3. Install this package and its requirements:
   ```shell
   (venv)$ pip install --editable ".[dev]" "tox>=4.11"
   ```

To run the test app interactively, use ``tox -e interactive``, visit
[http://127.0.0.1:8020/admin](http://127.0.0.1:8000/admin/) and log in
with `admin` / `changeme`.

### Contributing

The tests are written with [pytest] and code coverage is measured with [coverage].
You can use the following commands while developing:
- ``make test``: run the tests and output a quick report of code coverage
- ``make test-wip``: only run the tests marked as 'wip'
- ``make test-all``: run the tests on all supported versions of Django and
  Wagtail with [nox]

The Python code is formatted and linted thanks to [ruff]. You can check the code
with ``make lint`` and try to fix the reported issues with ``make format``.

When submitting a pull-request, please ensure that the code is well formatted
and covered, and that all the tests pass.

[pytest]: https://docs.pytest.org/
[coverage]: https://coverage.readthedocs.io/
[nox]: https://nox.thea.codes/
[ruff]: https://docs.astral.sh/ruff/

## License

This extension is mainly developed by [Cliss XXI](https://www.cliss21.com) and
licensed under the [AGPLv3+](LICENSE). Any contribution is welcome!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "wagtail-cblocks",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "blocks, streamfield, wagtail",
    "author": null,
    "author_email": "Cliss XXI <contact@cliss21.com>",
    "download_url": "https://files.pythonhosted.org/packages/be/e3/951d2a583fb31f68c20789747221468a534e46a74be28855115d34b0b200/wagtail_cblocks-0.5.1.tar.gz",
    "platform": null,
    "description": "# wagtail-cblocks\n\nA collection of StreamField blocks to use in Wagtail CMS.\n\n**Warning!** This project is still early on in its development lifecycle. It is\npossible for breaking changes to occur between versions until reaching a stable\n1.0. Feedback and pull requests are welcome.\n\n## Requirements\n\nwagtail-cblocks requires the following:\n- **Python 3** (3.8, 3.9, 3.10, 3.11, 3.12)\n- **Django** (4.2 LTS, 5.1)\n- **Wagtail** (5.2 LTS, 6.2)\n\n## Installation\n\n1. Install using ``pip``:\n   ```shell\n   $ pip install wagtail-cblocks\n   ```\n2. Add ``wagtail_cblocks`` to your ``INSTALLED_APPS`` setting:\n   ```python\n   INSTALLED_APPS = [\n       # ...\n       'wagtail_cblocks',\n       # ...\n   ]\n   ```\n\n## Usage\n\nEach block comes with a template made for Bootstrap 5 which is not shipped by\nthis plugin. If you plan to use them as is, you must have at least the Bootstrap\nstylesheet loaded in your base template - refer as needed to the\n[Bootstrap documentation](https://getbootstrap.com/).\n\nIn waiting for the documentation, here is a sample usage:\n\n```python\nfrom wagtail.admin.edit_handlers import StreamFieldPanel\nfrom wagtail.blocks import StreamBlock\nfrom wagtail.fields import StreamField\nfrom wagtail.models import Page\n\nfrom wagtail_cblocks.blocks import (\n    ButtonBlock,\n    ColumnsBlock,\n    HeadingBlock,\n    ImageBlock,\n    ParagraphBlock,\n)\n\n\nclass BaseBlock(StreamBlock):\n    title_block = HeadingBlock()\n    paragraph_block = ParagraphBlock()\n    button_block = ButtonBlock()\n    image_block = ImageBlock()\n\n\nclass BodyBlock(BaseBlock):\n    columns_block = ColumnsBlock(BaseBlock())\n\n\nclass StandardPage(Page):\n    body = StreamField(BodyBlock())\n\n    content_panels = Page.content_panels + [\n        StreamFieldPanel('body'),\n    ]\n```\n\nFactories are also provided for some of the blocks to ease tests - see\n[`wagtail_cblocks/factories.py`](wagtail_cblocks/factories.py). To make use of\nthem, install the extra *factories* requirements:\n\n```shell\n$ pip install wagtail-cblocks[factories]\n```\n\n## Development\n### Quick start\n\nTo set up a development environment, ensure that Python 3 is installed on your\nsystem. Then:\n\n1. Clone this repository\n2. Create a virtual environment and activate it:\n   ```shell\n   $ python3 -m venv venv\n   $ source venv/bin/activate\n   ```\n3. Install this package and its requirements:\n   ```shell\n   (venv)$ pip install --editable \".[dev]\" \"tox>=4.11\"\n   ```\n\nTo run the test app interactively, use ``tox -e interactive``, visit\n[http://127.0.0.1:8020/admin](http://127.0.0.1:8000/admin/) and log in\nwith `admin` / `changeme`.\n\n### Contributing\n\nThe tests are written with [pytest] and code coverage is measured with [coverage].\nYou can use the following commands while developing:\n- ``make test``: run the tests and output a quick report of code coverage\n- ``make test-wip``: only run the tests marked as 'wip'\n- ``make test-all``: run the tests on all supported versions of Django and\n  Wagtail with [nox]\n\nThe Python code is formatted and linted thanks to [ruff]. You can check the code\nwith ``make lint`` and try to fix the reported issues with ``make format``.\n\nWhen submitting a pull-request, please ensure that the code is well formatted\nand covered, and that all the tests pass.\n\n[pytest]: https://docs.pytest.org/\n[coverage]: https://coverage.readthedocs.io/\n[nox]: https://nox.thea.codes/\n[ruff]: https://docs.astral.sh/ruff/\n\n## License\n\nThis extension is mainly developed by [Cliss XXI](https://www.cliss21.com) and\nlicensed under the [AGPLv3+](LICENSE). Any contribution is welcome!\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Collection of StreamField blocks for Wagtail",
    "version": "0.5.1",
    "project_urls": {
        "Issues": "https://framagit.org/cliss21/wagtail-cblocks/-/issues",
        "Repository": "https://framagit.org/cliss21/wagtail-cblocks"
    },
    "split_keywords": [
        "blocks",
        " streamfield",
        " wagtail"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b533dbab3ca1ed6ef20cc3d777c58d1bb5b0116e6e9ab35764dfe452e1603a56",
                "md5": "ce80dc841fc79c40adbc2049df58c175",
                "sha256": "7367abac58313b10a85fadeaaedb33b7c5820697b7ff0243b84252e6ebd0dd26"
            },
            "downloads": -1,
            "filename": "wagtail_cblocks-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ce80dc841fc79c40adbc2049df58c175",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 24940,
            "upload_time": "2024-08-09T14:32:45",
            "upload_time_iso_8601": "2024-08-09T14:32:45.978978Z",
            "url": "https://files.pythonhosted.org/packages/b5/33/dbab3ca1ed6ef20cc3d777c58d1bb5b0116e6e9ab35764dfe452e1603a56/wagtail_cblocks-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bee3951d2a583fb31f68c20789747221468a534e46a74be28855115d34b0b200",
                "md5": "5f99cd22a010e0bdfb1887b711cba479",
                "sha256": "281f97c05e79529f1f2726f1531d30564bb231acf2ab8f29114534b6844c352d"
            },
            "downloads": -1,
            "filename": "wagtail_cblocks-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5f99cd22a010e0bdfb1887b711cba479",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 33636,
            "upload_time": "2024-08-09T14:32:47",
            "upload_time_iso_8601": "2024-08-09T14:32:47.539912Z",
            "url": "https://files.pythonhosted.org/packages/be/e3/951d2a583fb31f68c20789747221468a534e46a74be28855115d34b0b200/wagtail_cblocks-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-09 14:32:47",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "wagtail-cblocks"
}
        
Elapsed time: 0.37311s