How do I use "reverse" or an equivalent to refer to urls that are hooked into DjangoCMS?
I'm using DjangoCMS with app integration, like documented 开发者_运维百科here:
http://readthedocs.org/docs/django-cms/en/latest/extending_cms/app_integration.html
This, however, means that my app's urls in no longer referred to in the global urls.py
.
Now, if I try to use a reverse
on one of the urls of my app this fails. This kind of makes sense, since the urls of my app are no longer in my urls.py
. However, even though it makes sense, it's very annoying.
Weirdly enough, the {% url %}
decorator does still work. Any idea on how to proceed?
The URLs can be reversed on apphooked apps, as long as the apphook is hooked on a page in all languages and the server is restarted after it has been hooked.
In some cases there has been issues with the reverse function, prefixing the URL name with the language namespace should fix that. Eg: reverse('de:myview')
as opposed to just reverse('myview')
. This does not apply to the {% url %}
tag.
精彩评论