I have added support for plugins to register URL patterns in a similar way as Django allows ModelAdmins to register their URLs. But as plugins extend ModelAdmins I used get_plugin_urls as a method name.
This is useful when plugin has to talk back to the admin, probably asynchronously.
Documentation is included.
Added support for plugins to register URL patterns for views.
Documentation for get_plugin_urls method.
Not an accepted feature for 2.2, to keep the pull requests queue clean I'll close this
Can we discuss on this, even if it is closed?
Somehow I love the idea because instinctively I always want to create a CMSPlugin first, say for my News model, but then I realize that the model will need several views (like index, details, archive), so I switch to a AppHook instead. And then: What if I want to place my news on a page AND a contact form (for example in the footer), which needs several views as well - not possible (right?).
However having CMSPlugins with their own url tree would mean that it is very likely to have clashing URLs, isn't it? How are we gonna prevent this?
I very much like the idea
I solved clashing by having plugin URLs restricted to their namespace. Check the documentation commit above. So for example markup plugin have their URLs under: /admin/cms/page/plugin/<plugin name>/.
Of course this is open to discussion. I have tried both. And it is very simple to change it (just move plugin_pool.get_patterns() to urls.py). But then I noticed that this could clash with user generated content. So I decided that it is better that it is under admin and to make things simple I used the fact that Django CMS already registers with admin.
So those URLs are mostly meant for URLs which will not be directly visible to the user. For those which would be I think the best approach is AppHook as it allows user to customize where and how it wants them.
I agree this is a very interesting idea and we should definitely consider it for 2.3.