title: Why does Django try the wrong url pattern?
body: <p>Django tries the wrong url pattern but I can not find my mistake.</p>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>     url(r'^message/(?P&lt;advertisementid&gt;(\d+))/$', chat_view, name="chat_view_with_toid"),
       url(r'^profile/(?P&lt;userid&gt;(\d+))/$', profile_view, name="profile"),
       url(r'^details/(?P&lt;advertisementid&gt;(\d+))/$', details_view, name='details'),
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def details_view(request, advertisementid):
      advertisement_data = Advertisement.objects.get(id=advertisementid)
      return render(request, "details.html", {"advertisement_data": advertisement_data})
  
  def profile_view(request, userid):
      advertisements = Advertisement.objects.filter(user__id=userid)
      return render(request, "profile.html", { 'advertisements': advertisements } )
  </code></pre>
  
  <p><strong>details.html</strong> (from where I want to resolve to the users profile)</p>
  
  <pre><code>&lt;a href="{% url 'profile' userid=advertisement_data.user.id %}" style="text-decoration:none;"&gt;
  &lt;input type="submit" class="details-btn-profile" value="Profile"&gt;&lt;/a&gt;
  
      &lt;a href="{% url 'chat_view_with_toid' advertisementid=advertisement_data.id %}" 
      style="text-decoration:none"&gt;
      &lt;input type="submit" class="details-btn-contact" value="Kontakt"&gt;&lt;/a&gt;
  </code></pre>
  
  <p><strong>main.html</strong></p>
  
  <pre><code>&lt;a href="{% url 'details' advertisementid=advertisement.id %}"&gt;
  &lt;img src="{% static advertisement.image.url  %}" alt="Image"/&gt;&lt;/a&gt;
  </code></pre>
  
  <p>When I click on button <code>class="details-btn-profile"</code> Django gives me this error:</p>
  
  <blockquote>
    <p>Reverse for 'details' with no arguments not found. 1 pattern(s) tried: ['details/(?P(\d+))/$']</p>
  </blockquote>
  
  <p>Why does it resolve to details ? Any ideas ?</p>