A similar question was answered here.
My situation is slightly different though. I have created a reusable app called "categories". In my project I have an app called "dashboard". The dashboard app includes the reusable "categories" app. This causes the following to be used to reverse a url
reverse('dashboard:categories:browse')
However, my reusable app has no knowledge of the "dashboard" namespace. I want to be able to use the solution I linked above to reverse only the following within the reusable categories app.
reverse('categories:browse')
Currently, setting app_name
in categories.urls does not work. I get NoReverseMatch
when reversing "categories:browse".
Here are excerpts of how the apps are included in the urls.py files.
# myproject/urls.py url( r'^dashboard/', include( 'dashboard.urls', namespace='dashboard', ) ), # dashboard/urls.py url( r'^categories/', include( 'categories.urls', namespace="categories", ), ),