title: Django view getting called twice (double GET request)
body: <p>I'm creating a classifieds website in Django. A single view function handles global listings, city-wise listings, barter-only global listings and barter-only city-wise listings. This view is called <code>ads</code>.</p>
  
  <p>The url patterns are written in the following order (note that each has a unique name although it's tied to the same <code>ads</code> view):</p>
  
  <pre><code>urlpatterns = patterns('',
      url(r'^buy_and_sell/$', ads,name='classified_listing'),
      url(r'^buy_and_sell/barter/$', ads,name='barter_classified_listing'),
      url(r'^buy_and_sell/barter/(?P&lt;city&gt;[\w.@+-]+)/$', ads,name='city_barter_classified_listing'),
      url(r'^buy_and_sell/(?P&lt;city&gt;[\w.@+-]+)/$', ads,name='city_classified_listing'),
  )
  </code></pre>
  
  <p>The problem is that when I hit the url named <code>classified_listing</code> in the list above, the function <code>ads</code> gets called <strong>twice</strong>. I.e. here's what I see in my terminal:</p>
  
  <pre><code>[14/Jul/2017 14:31:08] "GET /buy_and_sell/ HTTP/1.1" 200 53758 
  [14/Jul/2017 14:31:08] "GET /buy_and_sell/None/ HTTP/1.1" 200 32882
  </code></pre>
  
  <p>This means double the processing. I thought <code>urls.py</code> returns the first url pattern matched. What am I doing wrong and what's the best way to fix this? All other calls work as expected btw (i.e. only once). </p>
  
  <p><em>Note: Ask for more information in case I've missed something.</em></p>
  
  <hr>
  
  <p>Great explanation to understand these type of occurences: <a href="https://groups.google.com/d/msg/django-users/CRMMYWix_60/KEIkguUcqxYJ" rel="nofollow noreferrer">https://groups.google.com/d/msg/django-users/CRMMYWix_60/KEIkguUcqxYJ</a></p>