An InlinePanel variant allowing multiple items to be quickly selected
Project description
Wagtail Multiple Chooser Panel
An InlinePanel variant allowing multiple items to be quickly selected
About
This package provides an improved user interface for the common setup of a chooser widget inside an InlinePanel - for example, an image gallery consisting of a list of images chosen from the Wagtail image library. Normally, this would require adding a new child form for each item, opening the chooser modal and selecting an individual item each time. With the MultipleChooserPanel
provided by this package, the "Add item" button now opens the chooser modal immediately, with the ability to select multiple items - all selected items are then added as child forms.
In this version, only choosers implemented via wagtail-generic-chooser are supported; it is planned that this functionality will be incorporated into a future Wagtail release, with support for all of Wagtail's built-in choosers as well as custom choosers created through ChooserViewSet.
Links
Supported versions
- Python 3.7 - 3.11
- Django 3.2 - 4.1
- Wagtail 4.1
Installation
- Ensure you have wagtail-generic-chooser version 0.5 or above installed
pip install wagtail-multiple-chooser-panel
- Add
"wagtail_multiple_chooser_panel"
to INSTALLED_APPS
Usage
Beginning from an InlinePanel
setup where the child model has a field with a chooser widget defined through wagtail-generic-chooser
, such as:
class BlogPersonRelationship(Orderable, models.Model):
page = ParentalKey(
"BlogPage", related_name="blog_person_relationship", on_delete=models.CASCADE
)
person = models.ForeignKey(
"base.Person", related_name="person_blog_relationship", on_delete=models.CASCADE
)
panels = [FieldPanel("person", widget=PersonChooser)]
class BlogPage(Page):
content_panels = Page.content_panels + [
# ...
InlinePanel(
"blog_person_relationship",
label="Author(s)", min_num=1
),
]
Import MultipleChooserPanel
from wagtail_multiple_chooser_panel.panels
, replace InlinePanel
with MultipleChooserPanel
, and add a new chooser_field_name
parameter that specifies the field of the child model that has the chooser widget:
from wagtail_multiple_chooser_panel.panels import MultipleChooserPanel
# BlogPersonRelationship definition remains unchanged
class BlogPage(Page):
content_panels = Page.content_panels + [
# ...
MultipleChooserPanel(
"blog_person_relationship",
chooser_field_name="person",
label="Author(s)", min_num=1
),
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file wagtail-multiple-chooser-panel-0.1.0.tar.gz
.
File metadata
- Download URL: wagtail-multiple-chooser-panel-0.1.0.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07212f02ad43f1d609b5d6257b1743ec805a62e0dc9336221ebf23dbccc7689d |
|
MD5 | abf1ca70c742eeef83a84ad41d929e38 |
|
BLAKE2b-256 | d5975dbf202f0d8e4b1a208f59dcf3a326ec60dc9a71b208b427391473c8586e |
File details
Details for the file wagtail_multiple_chooser_panel-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: wagtail_multiple_chooser_panel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a145a9d6300bd80d872ccfe557defb86ec1b3e0f6695cdc480643ed4bc07dd6 |
|
MD5 | 57cea4ec166828450b8ce26430d0d5b1 |
|
BLAKE2b-256 | 476b7353d58ff840c6744e5cff32780a59471d6435dc0e0fd7c6f2211c8a9f94 |