django-polymorphic/polymorphic/admin
James Murty 37f92b3a3f Fix get parent admin when intermediate not root ctype model is registered
This change fixes an issue where django-polymorphic raises a
`ParentAdminNotRegistered` exception when you register an admin for a
child model ancestor, but not for the root ancestor as pointed to by
the `polymorphic_ctype` field. This error occurs only when you *Save*
the child model detail form, not when you *Save and continue* on that
same form.

This situation occurs for us when using django-fluent-pages version
1.0.1 which has an intermediate `Page` model registered with a parent
admin to show the pages listing. The existing `_get_parent_admin` method
expects an admin to be registered for the root `UrlNode` model pointed
to by the `polymorphic_ctype` field.

This fix uses a potentially naive and slow brute-force approach where
it walks up the class hierarchy and checks  whether a parent admin is
registered for each ancestor model, unless/until it finds one.

See also https://github.com/ic-labs/django-icekit/issues/31/
2016-10-13 09:35:13 +11:00
..
__init__.py Rename inline/formset classes to avoid more confusion. 2016-08-09 01:11:05 +02:00
childadmin.py Fix get parent admin when intermediate not root ctype model is registered 2016-10-13 09:35:13 +11:00
filters.py docs start for formset/inline support 2016-06-13 10:18:18 +02:00
forms.py Convert `admin.py` into a package. 2016-06-10 14:25:06 +02:00
generic.py Rename inline/formset classes to avoid more confusion. 2016-08-09 01:11:05 +02:00
helpers.py remove unneeded import 2016-08-15 16:10:55 +02:00
inlines.py Update polymorphic inline script. 2016-08-10 11:45:48 +02:00
parentadmin.py Improve #215 to handle cases where the real_admin points back to self. 2016-06-13 10:53:29 +02:00