Support for plugins to register URL patterns #738

wants to merge 2 commits into


None yet
4 participants

mitar commented Mar 6, 2011

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.


ojii commented Mar 6, 2011

Not an accepted feature for 2.2, to keep the pull requests queue clean I'll close this


mbrochh commented Mar 7, 2011

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?


digi604 commented Mar 7, 2011

I very much like the idea


mitar commented Mar 7, 2011

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 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.


ojii commented Mar 7, 2011

I agree this is a very interesting idea and we should definitely consider it for 2.3.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment