Skip to content

StackedPolymorphicInline & Grappelli support #234

@Quantra

Description

@Quantra

Hi I'm using commit #4a60c1f so apologies if this is on its way and thank you to everyone contributing to this project.

Currently when using Grappelli with polymorphic I can use StackedPolymorphicInline to create the inline as per the docs but it does not render correctly in the admin site.

It appears the blank dummy forms are being displayed and validated on submission and new forms are added in a strange way.

Also Grappelli's drag and drop reordering through sortable_field_name doesn't appear compatible. It would be amazing to have this working with an order field on the parent model.

I've attached a couple of screenshots showing the StackedPolymorphicInline when adding a new object and after adding a child field.

class ContentBlockInline(StackedPolymorphicInline):
    class WYSIWYGBlockInline(StackedPolymorphicInline.Child):
        model = WYSIWYGBlock


    class HeroBlockInline(StackedPolymorphicInline.Child):
        model = HeroBlock

    model = ContentBlock

    child_inlines = (WYSIWYGBlockInline, HeroBlockInline)

    extra = 0
    min_num = 0
    sortable_field_name = 'order'

screen shot 2016-08-22 at 21 17 02

screen shot 2016-08-22 at 21 21 42

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions