Commit Graph

13 Commits (d1c58459665e74e3d99ff815d07124948e059af4)

Author SHA1 Message Date
Tadas Dailyda d1c5845966 further childadmin fieldsets improvements
(cherry picked from commit 15426dc695)
2018-04-16 11:21:51 +02:00
Diederik van der Boor 7de1366f6f Improve docs of PolymorphicChildModelAdmin attributes
(cherry picked from commit c437524876)
2018-04-16 11:21:51 +02:00
Diederik van der Boor fe7de17ecf Make the admin `base_model` setting optional.
It can be detected using get_base_polymorphic_model()

(cherry picked from commit cf0cb2478f)
2018-04-16 11:21:51 +02:00
Krzysztof Nazarewski 925c4de34f `declared_fieldsets` typo fix
(cherry picked from commit 697df65c7b)
2018-04-16 11:08:27 +02:00
Diederik van der Boor 3170ea95c2 autoflake: remove unused imports and statements 2016-12-19 11:12:40 +01:00
Diederik van der Boor 1d13b4f3c5 autopep8, except line length 2016-12-19 11:10:03 +01:00
Diederik van der Boor 58f89efa5d Brush up the `ParentAdminNotRegistered` fix a bit for flow clarity. 2016-10-14 11:51:03 +02:00
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
Diederik van der Boor 352b56e104 Merge branch 'feature/inlines' 2016-08-10 11:48:02 +02:00
Diederik van der Boor ac98a8123a Raise ParentAdminNotRegistered instead of KeyError 2016-07-08 12:06:04 +02:00
Tadas Dailyda 0edd0d4acd fix redirects after child model add/change in PolymorphicChildModelAdmin 2016-06-14 19:17:04 +03:00
Diederik van der Boor 8c42893abd docs start for formset/inline support 2016-06-13 10:18:18 +02:00
Diederik van der Boor 2a599b5f99 Convert `admin.py` into a package.
Clears up the code and prepare to receive more changes for formset support.
2016-06-10 14:25:06 +02:00