HI everyone,
I've created a django CMS apphook. Unfortunately I'm not able to reverse apphook urls using the Python shell.
The cms_app.py file looks like:
class ArticleApp (CMSApp):
name = _('Article App')
app_name = 'article_app'
urls = ['article.urls']
apphook_pool.register(ArticleApp)
This is my urls.py file:
urlpatterns = patterns('',
url(r'^(?P<slug>[\w\-]+)?', ArticleView.as_view(), name='article-by-slug'),
)
The template file is:
{% url 'article_app:article-by-slug' article.slug %}
URL reversing inside the template performs like expected. If I try to do the same using the Python shell I receive an error message:
>>> from django.core.urlresolvers import reverse
>>> from article.models import Article
>>> a = Article.objects.get(pk=1)
>>> reverse('article_app:article-by-slug', kwargs={'slug': a.slug})
# Reverse for 'article_app:article-by-slug' with arguments '()' and keyword arguments '{'slug': 'this-is-article-1'}' not found.
Additional urls defined in the main urls.py work like expected from inside the shell. Only apphook urls don't work.
Any suggestions? I'd appreciate your help!
Thank you!