title: How to Deal with Namespacing URLs in a Reusable Django App
body: <p>I have been struggling with reversing URLs with a reusable Django app. Here's the basic layout of my problem.</p>
  
  <p><strong>Reusable App:</strong></p>
  
  <p>In the <code>urls.py</code> file it has the following pattern:</p>
  
  <pre><code>url(r'^object-list/$', ObjectListView.as_view(), name='object-list')
  </code></pre>
  
  <p>Somewhere in the reusable app's <code>views.py</code>, there is the following reverse call:</p>
  
  <pre><code>reverse('object-list')
  </code></pre>
  
  <hr>
  
  <p><strong>My Project:</strong></p>
  
  <p>In the project where I want to use this app, I have another conflicting view name, so I namespace the app's URLs like so:</p>
  
  <pre><code>url(r'^app-stuff/', include('app.urls', namespace='app'))
  </code></pre>
  
  <hr>
  
  <p><strong>The Problem:</strong></p>
  
  <p>This has the consequence of causing all reverse calls within the app to throw a <code>NoReverseMatch</code> exception when it tries to lookup <code>object-detail</code>, because the URL now has the name <code>app:object-detail</code>.</p>
  
  <p>I have access to the app in question, so I can modify the calls it makes to <code>reverse</code>, but I would like to do it in a way that doesn't involve hardcoding a namespace. I have read the documentation on the <code>current_app</code> and <code>namespace</code> arguments to the <code>include</code> function but I don't quite understand if they would help solve the issue I'm having.</p>
  
  <p>Any suggestions you might have are greatly appreciated.</p>