0

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/$'] 
1
  • 1
    You don't pass parameter to your url, It's impossible to resolve it Commented Jan 11, 2016 at 7:35

1 Answer 1

1

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 %}'>
Sign up to request clarification or add additional context in comments.

8 Comments

but why wouldn't that parameter be passed through the urls, like it is everywhere else? when i try to do this I get the same failure
Er, what? I don't understand your comment at all. The parameter is passed to your view, like any other parameter; it's up to you to actually do something with it.
what I meant is that the parameter should be captured from the url, right? those parameters are captured from the url regex and the passed into the view. I think I meant to say captured instead of passed. Does that make more sense?
No, it doesn't. It is captured. It goes into your view as a parameter. What makes you think that's not happening?
I don't think it doesn't. I think I just misspoke and made it unclear. Even when I pass the argument in my url (parameter=value) I still get a Reverse lookup not found. What can I do to make my problem clearer?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.