Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MultipleChooserPanel in nested InlinePanel #11904

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elhussienalmasri
Copy link
Contributor

Fixes #11233

the same issue exist in "ImageChooser" and most of the other widget like "SnippetChooser" and "DocumentChooser".
if this solution is suitable, other widgets could by solved by the same solution.

the other widgets not work but "MultipleChooserPanel" with "ImageChooser" widget in nested "InlinePanel" works, as shown below:

After Before
After Before

Copy link

squash-labs bot commented Apr 29, 2024

Manage this branch in Squash

Test this branch here: https://elhussienalmasrifix-multiplech-lpq23.squash.io

@elhussienalmasri
Copy link
Contributor Author

elhussienalmasri commented Apr 29, 2024

this issue could be solved without any modification , but just add outer "MultipleChooserPanel" with same widget as defined in the inner "MultipleChooserPanel" .if inner has "ImageChooser" just add like it in the outer. as shown below:

  class NestedPanels(Page):
    
    content_panels = Page.content_panels +  [
      InlinePanel("inner_MultipleChooserPanel"),
      # add outer  "MultipleChooserPanel" wih same widget.
      MultipleChooserPanel("outer_MultipleChooserPanel", chooser_field_name="image"),
    ]


  class SectionImage(Orderable):
    section = ParentalKey(NestedPanels, on_delete=models.CASCADE, related_name="outer_MultipleChooserPanel")
    image = models.ForeignKey("wagtailimages.Image", on_delete=models.CASCADE, related_name="+")

    panels = [
        FieldPanel("image"),
    ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MultipleChooserPanel does not work when used in a nested InlinePanel
1 participant