# Trouble Understanding How Nested Namespaces Should Work

**URL:** <https://forum.djangoproject.com/t/trouble-understanding-how-nested-namespaces-should-work/8754>\
**Category:** Using Django\
**Created:** [July 12, 2021, 10:48pm UTC](https://forum.djangoproject.com/t/trouble-understanding-how-nested-namespaces-should-work/8754 "2021-07-12T22:48:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![megaman821](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/megaman821/32/5137_2.png) [@megaman821](https://forum.djangoproject.com/u/megaman821)\
**Post date:** [July 12, 2021, 10:48pm UTC](https://forum.djangoproject.com/t/trouble-understanding-how-nested-namespaces-should-work/8754/1 "2021-07-12T22:48:13Z")

</div>

Let’s say I have an app users with an app\_name of `users` in its urls.py. I want to include those urls in an app with the app\_name `clients` and one with the app\_name `admins`.

So `{% url 'clients:users:list' %}` resolves fine as does `{% url 'admins:users:list" %}` but if I want to add a non-prefixed create link `{% url 'users:create' %}` on the user list page, it won’t pick up on the top-level name space I am on and append it to users:create. Is there a good way to make this work?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 12, 2021, 11:51pm UTC](https://forum.djangoproject.com/t/trouble-understanding-how-nested-namespaces-should-work/8754/2 "2021-07-12T23:51:58Z")

</div>

If this is a case where you are including this template from another template, you might be able to pass the top level into the template and concatenate it with that literal.  
Something to the effect of:  
`{% include "template.html" with prefix="clients" %}`

Then, within that included template:  
`{% url prefix|stringformat:"s:users:create" %}`  
(Warning, winging this off-the-cuff - There may be a syntax error here.)

---

<div class="post-metadata">

**Author:** ![megaman821](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/megaman821/32/5137_2.png) [@megaman821](https://forum.djangoproject.com/u/megaman821)\
**Post date:** [July 13, 2021, 2:51am UTC](https://forum.djangoproject.com/t/trouble-understanding-how-nested-namespaces-should-work/8754/3 "2021-07-13T02:51:24Z")

</div>

I was hoping I was just missing a way to feed the namespace into the url tag. When I inspect the `request.resolver_match` I can see `namespace` set to `"clients:users"` and `namespaces` set to `["clients", "users"]`. I guess I can alway just create an extended url tag.

---

<div class="post-metadata">

**Author:** ![CodenameTim](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/codenametim/32/31507_2.png) [@CodenameTim](https://forum.djangoproject.com/u/CodenameTim)\
**Post date:** [July 14, 2021, 1:50pm UTC](https://forum.djangoproject.com/t/trouble-understanding-how-nested-namespaces-should-work/8754/4 "2021-07-14T13:50:38Z")

</div>

What you’re describing should work according to the [docs](https://docs.djangoproject.com/en/3.2/topics/http/urls/#reversing-namespaced-urls). Is the view that’s serving the response within one of those two apps?
