Skip to content

An inline within an inline #581

@lyaguxafrog

Description

@lyaguxafrog

I wanted to make an inline inside the inline, but I didn't understand how to do it, I tried something like this:

class ContentBlockAdmin(StackedPolymorphicInline):

    class Left_text(StackedPolymorphicInline.Child):
        model = ScreenTextBlock_left


    class Left_image(StackedPolymorphicInline.Child):
        model = ScreenImageBlock_left

    model = ContentBlock
    child_inlines = (
        Left_text,
        Left_image
    )

class ScreenInline(PolymorphicInlineSupportMixin, admin.StackedInline):
    model = Screens
    extra = 0
    inlines = (ContentBlockAdmin, )


class PracticumAdmin(admin.ModelAdmin):
    inlines = (ScreenInline, )


admin.site.register(Practicum, PracticumAdmin)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions