Joff
Joff

Reputation: 12177

django: using url parameters and url namespacing simultaneously

I have a namespaced URL...

 url(r'^(?P<page_lang>\w+)/forum/', include('djangobb_forum.urls', namespace='djangobb')),

which then goes through to another urls.py in an app...

url(r'^$', forum_views.index, name='index'),

but I am getting an error when it tries to reverse lookup by the namespace.

<a href="{% url 'djangobb:forum_posts_feed' %}">

I cannot see what is causing this, and I tried to use this fix...

django url parameters before include url with namespace

but I had no luck, any ideas?

EDIT:

I have verfied that it is being cause by the parameter being passed along with the namespace, because I replaced it with something static and the problem went away, how can I make this work?

EDIT2:

error:

Reverse for 'forum_posts_feed' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'(?P<page_lang>\\w+)/forum/feeds/posts/$']

if i try to add "page_lang" to the url template tag, the error changes to this...

Reverse for 'forum_posts_feed' with arguments '(<SiteLanguage: SiteLanguage object>,)' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'(?P<page_lang>\\w+)/forum/feeds/posts/$'] 

Upvotes: 0

Views: 310

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599490

It seems odd that you can't see what's causing this, since you obviously know it's to do with the parameter. Where do you think that value is going to come from? You need to pass it in your url tag:

<a href='{% url "myname:index" parameter=value %}'>

Upvotes: 1

Related Questions