title: How to dealing with a 'str' object has no attribute '_meta' error?
body: <p>So i have been looking at adding ratings functionality to my objects and decided to go with Agon-ratings <a href="https://github.com/eldarion/agon-ratings" rel="nofollow">https://github.com/eldarion/agon-ratings</a></p>
  
  <pre><code>i have followed their usage documentation &lt;http://agon-ratings.readthedocs.org/en/latest/usage.html&gt;
  did this with my template,
  {% extends "base.html" %}
  {% load url from future %}
  {% block title %}Don't you jus love easy food{% endblock %}
  {% block content %}
  {% load agon_ratings_tags %}
  &lt;br/&gt;
  &lt;br/&gt;
  
  &lt;div&gt;
  
  {% if found_entries %}
   &lt;p&gt;You searched for "{{ query_string }}".&lt;/p&gt; 
   {% for restaurant in found_entries %}
  
   &lt;div&gt;
     &lt;div&gt;
      &lt;table&gt;
       &lt;tr&gt;
          &lt;td&gt;dxtcfyguvhyju&lt;/td&gt;
  
  
        &lt;td&gt;&lt;a href="{% url 'f4l_menu' restaurant.id %}"&gt;{{ restaurant.restaurant_name }}&lt;/td&gt;&lt;/a&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
        &lt;td&gt;Location&lt;/td&gt;
        &lt;td&gt;{{restaurant.address}}&lt;/td&gt;
       &lt;/tr&gt;
      &lt;/table&gt;
  
   {% endfor %}
  {% overall_rating obj as the_overall_rating %}
  &lt;div class="overall_rating"&gt;{{ the_overall_rating }}&lt;/div&gt;
  &lt;div id= "user_rating"&gt;&lt;/div&gt;
  
  {% endif %}
  {% if query_string and not found_entries %}
   &lt;p&gt;No results found.&lt;/p&gt;
  {% else %}
   &lt;p&gt;Type a search query into the box above, and press "Submit" to search.&lt;/p&gt;
  {% endif %}
     &lt;/div&gt;
    &lt;/div&gt;
    &lt;div style="clear: both;"&gt;&lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  {% user_rating_js request.user obj %}
  {% endblock %}
  </code></pre>
  
  <p>when i load my page get the, <code>'str' object has no attribute '_meta'</code>
  I clearly dont understand where i went wrong. Btw am a beginner django developer developing my first django app </p>
  
  <p>the traceback,</p>
  
  <pre><code>Template error:
  In template /home/mats-invasion/projects/f4l/templates/public/search.html, error at line 31
     'str' object has no attribute '_meta'
     21 :         
  
  
     22 :       &lt;td&gt;&lt;a href="{% url 'f4l_menu' restaurant.id %}"&gt;{{ restaurant.restaurant_name }}&lt;/td&gt;&lt;/a&gt;
  
  
     23 :      &lt;/tr&gt;
  
  
     24 :      &lt;tr&gt;
  
  
     25 :       &lt;td&gt;Location&lt;/td&gt;
  
  
     26 :       &lt;td&gt;{{restaurant.address}}&lt;/td&gt;
  
  
     27 :      &lt;/tr&gt;
  
  
     28 :     &lt;/table&gt;
  
  
     29 :     
  
  
     30 :  {% endfor %}
  
  
     31 :  {% overall_rating obj as the_overall_rating %} 
  
  
     32 : &lt;div class="overall_rating"&gt;{{ the_overall_rating }}&lt;/div&gt;
  
  
     33 : &lt;div id= "user_rating"&gt;&lt;/div&gt;
  
  
     34 :  
  
  
     35 : {% endif %}
  
  
     36 : {% if query_string and not found_entries %}
  
  
     37 :  &lt;p&gt;No results found.&lt;/p&gt;
  
  
     38 : {% else %}
  
  
     39 :  &lt;p&gt;Type a search query into the box above, and press "Submit" to search.&lt;/p&gt;
  
  
     40 : {% endif %}
  
  
     41 :    &lt;/div&gt;
  
  
  Traceback:
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
    111.                         response = callback(request, *callback_args, **callback_kwargs)
  File "/home/mats-invasion/projects/f4l/f4l/f4l/views.py" in search
    64.   return render_to_response('public/search.html',context,context_instance=RequestContext(request))
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/shortcuts/__init__.py" in render_to_response
    20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
    176.         return t.render(context_instance)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/base.py" in render
    140.             return self._render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
    62.     return self.nodelist.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/base.py" in render
    823.                 bit = self.render_node(node, context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    74.             return node.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    123.         return compiled_parent._render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
    62.     return self.nodelist.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/base.py" in render
    823.                 bit = self.render_node(node, context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    74.             return node.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    123.         return compiled_parent._render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
    62.     return self.nodelist.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/base.py" in render
    823.                 bit = self.render_node(node, context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    74.             return node.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    62.             result = block.nodelist.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/base.py" in render
    823.                 bit = self.render_node(node, context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    74.             return node.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    62.             result = block.nodelist.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/base.py" in render
    823.                 bit = self.render_node(node, context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    74.             return node.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render
    281.                 return nodelist.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/base.py" in render
    823.                 bit = self.render_node(node, context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
    74.             return node.render(context)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/agon_ratings/templatetags/agon_ratings_tags.py" in render
    106.             ct = ContentType.objects.get_for_model(obj)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py" in get_for_model
    32.         opts = self._get_opts(model)
  File "/home/mats-invasion/projects/f4l/env/local/lib/python2.7/site-packages/django/contrib/contenttypes/models.py" in _get_opts
    20.         return model._meta.concrete_model._meta
  
  Exception Type: AttributeError at /search/
  Exception Value: 'str' object has no attribute '_meta'
  </code></pre>
  
  <p>in the views.py,</p>
  
  <pre><code>def search(request):
      query_string=''
      found_entries=None
      search_fields=('delivery_territory',)
      option=request.REQUEST.get('deliveryType',None)
      if option== 'D':
          start_set=Restaurant.objects.filter(services='DEL')
      elif option == 'P':
          start_set = Restaurant.objects.filter(services='PCK')
      else:
          start_set=Restaurant.objects.all()
      if ('q' in request.GET) and request.GET['q'].strip():
          query_string= request.GET['q']
          entry_query= get_query(query_string,search_fields)
          found_entries= start_set.filter(entry_query).order_by('created_on')
      obj = Restaurant.objects.all()
      context={
          'query_string':query_string,
          'found_entries':found_entries,
          'obj':obj,
      }
      return render_to_response('public/search.html',context,context_instance=RequestContext(request))
  </code></pre>