Skip to content

Nested InstanceSelectorPanel loses selectability #20

@danthedeckie

Description

@danthedeckie

If I have open a Instance Selector Panel pop-up, and then create a new object in there to select, it's fine.

But if while it's open, I open an Instance Selector Panel defined on that object - so being 2 levels deep, kind of thing,
then when I save the original object, it shows a regular admin listing view - so with 'edit' and 'delete' buttons, and no 'select' button.

Pseudo code:

class Category(ClusterableModel):
    name = models.CharField(max_length=100)


class Product(ClusterableModel):
    name = models.CharField(max_length=100)

    panels = [
        FieldPanel('name'),
        InlinePanel('categories')
    ]


class ProductCategory(ClusterableModel):
    category = ParentalKey(Category, on_delete=models.CASCADE, related_name="products")
    product = ParentalKey(Produce, on_delete=models.CASCADE, related_name="categories")

    panels = [
         InstanceSelectorPanel('category'),
         InstanceSelectorPanel('product'),
    ]


class ShopPage(Page):
    ...
    common_panels = [
        InlinePanel("shop_products"),
    ]


class ShopProduct(ClusterableModel):
    product = ParentalKey(Product, on_delete=models.CASCADE)
    parent_page = ParentalKey(ShopPage, on_delete=models.CASCADE, related_name="shop_products")
    panels = [
         InstanceSelectorPanel('product'),
         PageSelectorPanel('parent_page'),
    ]

I've solved currently by switching all of the sub-selectors into a more basic ModelChooserPanel that we're using in other places in the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions