Re: django-cms apphook urls don't work with reverse() using Python shell

2014-08-19 Thread Ramiro Morales
On Tue, Aug 19, 2014 at 8:14 AM, Philipp  wrote:
> [...]
>
> This is my urls.py file:
>
> urlpatterns = patterns('',
> url(r'^(?P[\w\-]+)?', ArticleView.as_view(),
> name='article-by-slug'),
> )
>
> [...]
 reverse('article_app:article-by-slug', kwargs={'slug': a.slug})

Try with::

reverse('article_app:article-by-slug', args=[a.slug])

> # Reverse for 'article_app:article-by-slug' with arguments '()' and keyword
> arguments '{'slug': 'this-is-article-1'}' not found.

Regards,

-- 
Ramiro Morales
@ramiromorales

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO7PdF-UrHAgOOFC2iS3NZbyXUs99%2B9xC7MrnXDUDaMFBkLT2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django-cms apphook urls don't work with reverse() using Python shell

2014-08-19 Thread Philipp
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[\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 appreciate your help!

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54b254d4-eb9c-468a-91b2-201fee0a8c1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.