Working code for a polymorphic admin, OK to integrate?

64 views
Skip to first unread message

vdb...@gmail.com

unread,
Mar 9, 2012, 12:09:39 PM3/9/12
to django-po...@googlegroups.com
Hi,

I've used django-polymorphic for my project, and also wrote a polymorphic admin interface.
This works really sweet!

I'd love to integrate this to django-polymorphic, and I'm curious if you have any suggestions for the code first.
(for example class naming, or things that should be done different). Licensing is currently Apache 2,
but I wouldn't mind relicensing to BSD if that is needed.

----
Some info:

The code is included in: https://github.com/edoburu/django-fluent-pages/
This is a "page tree app" that uses django-polymorphic to allow different models for each node.

The implementation uses two admin classes:
- one central "PolymorphicModelAdmin" that is registered in the admin site; it displays the list page, and looks up the actual derived admin class for the edit page.
- the add/edit pages are provided by the individual admin instances, all inheriting from the "PolymorpedModelAdmin" class (note the similar naming)

In particular, you can look at the files:
* utils/polymorphicadmin.py, the generic base class: https://github.com/edoburu/django-fluent-pages/blob/master/fluent_pages/utils/polymorphicadmin.py
* admin/urlnode*.py: https://github.com/edoburu/django-fluent-pages/tree/master/fluent_pages/admin
  * urlnodepolymorphicadmin.py is the actual class that is registered in the admin, it displays the list page, and
  * urlnodeadmin.py is the base class for all derived admin classes.
* pagetypes/*/ are all derived models, with a derived admin interface.

----

Greetings,

Diederik van der Boor
Reply all
Reply to author
Forward
0 new messages