django-polymorphic/polymorphic
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
..
admin Fix get parent admin when intermediate not root ctype model is registered 2016-10-13 09:35:13 +11:00
contrib Add helper function for django-guardian. 2016-09-01 12:15:21 +02:00
formsets Remove unsupported fk_name parameter for `polymorphic_modelformset_factory()` 2016-10-04 10:33:59 +02:00
locale add spanish translation 2015-10-12 11:44:01 -03:00
static/polymorphic Update polymorphic_inlines.css 2016-09-03 15:14:01 +01:00
templates/admin/polymorphic Fix marking a new formset item as empty-form on postback errors 2016-08-15 16:03:08 +02:00
templatetags Fix PEP8 whitespace issues 2015-12-28 15:16:29 +01:00
__init__.py Bump to 1.0.1 2016-09-11 21:34:37 +02:00
base.py Fix dumpdata hack on Windows 2016-09-12 10:35:47 +02:00
manager.py Rename manager.py => managers.py for consistency 2015-12-28 17:10:42 +01:00
managers.py Fixed the Python 3 unittests 2016-08-10 14:02:36 +02:00
models.py #216 Use self._state.db instead of `using` kwarg in model methods. 2016-05-30 18:55:03 -05:00
query.py #220 Pass hints to returned queryset in PolymorphicManager.get_queryset. 2016-06-12 22:15:37 -05:00
query_translate.py Fix for removed `Q.clone()` method in Django 1.10 2016-08-05 17:26:32 +02:00
showfields.py Fix Python 3 tests 2016-08-10 14:29:03 +02:00
tests.py Merge pull request #235 from benkonrath/contrib-guardian 2016-09-12 10:44:50 +02:00
tools_for_tests.py Fix PEP8 block comment issues (E265) 2015-12-28 15:16:42 +01:00