Thursday, January 29, 2015

Namespace url lookup inside template of an app

Hello,

writing currently an app which should show different things based on
namespace which is working already, but I do have problems with
generating the right url inside the templates of that app.
I tried to use:
{% url 'myaddons:index' %}
but that always shows the same namespace url the last one attached.

Currently have defined inside that app:
urlpatterns = patterns('',
url(r'^$', 'myaddons.views.index', name='index'),
)

Then have 2 other apps in one I define:
urlpatterns = patterns('',
url(r'^addons/', include('myaddons.urls',
namespace='wow-myaddons', app_name='myaddons')),
)

in the other one:
urlpatterns = patterns('',
url(r'^addons/', include('myaddons.urls', namespace='ws-myaddons',
app_name='myaddons')),
)

The base one is:

url(r'^wow/', include('warcraft.urls')),
url(r'^ws/', include('wildstar.urls')),

With what I tried it always resolve to:
/ws/addons/

I want it to resolve to:
/wow/addons/ if called with /wow/
and
/ws/addons/ if called with /ws/

Greetings,
Thorsten

--
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+unsubscribe@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/54CA96FC.8040305%40gmx.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment