Skip to content

Broken with django-polymorphic 4.x - _get_inheritance_relation_fields_and_models removed #278

Description

@didacta

Upgrading to django-polymorphic 4.x breaks nested-admin's polymorphic support:

AttributeError: 'MyModel' object has no attribute '_get_inheritance_relation_fields_and_models'

The issue is in get_polymorphic_related_models - it calls a private method that was removed from django-polymorphic.

Should be an easy fix using Django's public API:

def get_polymorphic_related_models(model):
    return list(model._meta.parents.keys())

This returns the same data (parent models for multi-table inheritance).

Tested on django-polymorphic 4.8.0, Django 5.x.

Can open a PR if you'd like.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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