title: Django: Passing model object values through url
body: <p>I'm having problems with passing model object values through a URL pattern. The URL:</p>
  
  <pre><code>url(r'^cities/(?P&lt;city&gt;\w+)/$', 'city_firm', name='city_firm'),
  </code></pre>
  
  <p>In the template (from the index page) I have:</p>
  
  <pre><code>&lt;a href="{% url city_firm city %}"&gt;{{ city }}&lt;/a&gt;
  </code></pre>
  
  <p>This is in a <code>for</code> loop.</p>
  
  <p>The related view is:</p>
  
  <pre><code>def city_firm(request, city):
      city1 = Cities.objects.get(city=city)
      cityf = city1.Firms.all()
      return render_to_response('cityfirm.html', {'cityf': cityf})
  </code></pre>
  
  <p>The two models (<code>Cities</code>, <code>Firms</code>) are in a many to many relationship.
  I keep getting <code>TemplateSyntaxError</code> at index (<code>NoReverseMatch while rendering: Reverse for 'city_firm' with arguments '(&lt;Cities: &gt;,)' and keyword arguments '{}' not found</code>). In the template link tag I tried: <code>{% url city_firm city=city %}</code>, <code>{% url city_firm city=cities.city %}</code>. Nothing changed. The <code>urlconf</code> part seems right. The problem seems to be in the template. Maybe there is an issue with the string values of the object as they aren't in English. But I took several precautions to prevent this. There is maybe something wrong with the view but the error says template. Any ideas?</p>
  
  <p><strong>Solution</strong>:<br>
  Thanks everyone! Finally I figured it out. The problem was simple: I was trying to send object attribute names through the url, that had non-English characters and spaces. To fix it, I had to edit my models. </p>