title: Django: Passing model object name through url
body: <p>I want pass model name as parameter to  views.py<br>
  But it does not woork very well<br>
  Please guide me how to do this  Thank you </p>
  
  <p>when I go to <code>http://127.0.0.1:8000/filter/image/party/</code><br>
  There is error said :  </p>
  
  <pre><code>'unicode' object has no attribute 'objects'
  </code></pre>
  
  <p>but the terminal can print mm='Party'</p>
  
  <p>Here is my code:</p>
  
  <p>models.py:</p>
  
  <pre><code>class Party(models.Model):  
       ....
  class Fun(models.Model):  
       .... 
  </code></pre>
  
  <p>urls.py: </p>
  
  <pre><code>urlpatterns = patterns('',
      url(r'^image/(?P&lt;model&gt;\w+)/$', views.object_list_1 ),
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>def object_list_1(request, model):
      mm =  model.capitalize()
      obj_list = mm.objects.all()        
      template_name = 'filterimgs/%s_list.html' % mm.lower()
      return render_to_response(template_name, {'object_list': obj_list, 
                            context_instance=RequestContext(request))
  </code></pre>