Skip to content

Can django-polymorphic filter the popup change list for raw ID fields? #144

@mrmachine

Description

@mrmachine

I have several polymorphic child models with M2M fields to each other, NOT to the parent model. I'm using the raw ID widget for these fields in the admin, but the popup change list shows a list of ALL child types of child model.

It seems that django-polymorphic would be in the best position to provide a customised ForeignKeyRawIdWidget that automatically filters the parent model's change list by content type.

Is this something you would be interested in merging?

Can you provide any guidance on how it might be implemented in django-polymorphic?

I am imagining the raw ID widget would just add ?polymorphic_ctype=N to the URL for the popup link IF the foreign key pointed to a child model, and PolymorphicParentModelAdmin.get_queryset() would filter the queryset on that if set.

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