Extracted from django-fluent-pages, ready for other apps too.
The polymorphic admin is implemented via a parent admin for the base
model, and separate admin interfaces for the child models.
The parent model needs to inherit PolymorphicParentModelAdmin,
and override `get_admin_for_model()` and `get_child_model_classes()`
to find the child admin interfaces.
The derived models have their own `ModelAdmin` class, which inherits
from `PolymorphicChildModelAdmin`. The parent admin redirects it's
change and delete views to the child admin.
By adding `polymorphic` to the INSTALLED_APPS, the breadcrumbs will be
fixed as well, to remain unchanged between the child applications.
During the development of django-polymorphic-tree it was discovered that
the PolymorphicParentModelAdmin could actually be made much simpler.
It features a `child_models` attribute now, so there is very little code
needed to actually implement a polymorphic admin now.
Also found various issues which are together fixed in this commit for
As discovered in django-polymorphic-tree and django-fluent-pages,
the raw_id_fields didn't work in Django 1.4 because the fields actively
check which models are actually registered in the admin site.
Hence, the parent admin site _registry is inserted in the child admin as
well. This also completely moves the initialisation of the child admin
into this class, using a `get_child_models()` function,
akin to the static `child_models` attribute.