title: Search through multiple fields in Django
body: <p>I'm trying to build a search system, and I want to search by multiple fields<code>name, state, city,</code> in my django models. I wrote the below code, yet I've been unable to figure out how to go about it.</p>
  
  <p>Models:</p>
  
  <pre><code>class Finhall(models.Model):
       user=models.ForeignKey(User)
       name=models.CharField(max_length=250, unique=True)
       address=models.CharField(max_length=200)
       city=models.CharField(max_length=200)
       state=models.CharField(max_length=200)
  
       def __unicode__(self):
           return u'%s' % (self.name)
  </code></pre>
  
  <p>Views.py</p>
  
  <pre><code>def hup_find(request):
      if ('q' in request.GET) and request.GET['q'].strip():
          query_string=request.GET.get('q')
          seens=Finhall.objects.filter(name__icontains=query_string)
      else:
          seens=None
      return render_to_response('find.html',{'seens':seens},context_instance=RequestContext(request))
  </code></pre>
  
  <p>Template:</p>
  
  <pre><code> {% block content %}
       &lt;body&gt;
      &lt;form action="" method="GET"&gt;
      &lt;input type="text" name="q" /&gt;
      &lt;button type="submit"&gt;search&lt;/button&gt;
     &lt;/form&gt;
  
  
      {% for seen in seens %}
  
      &lt;p&gt; {{seen.name}}&lt;/p&gt;
  
      {% empty %}
  
        &lt;p&gt; no search &lt;/p&gt;
      {% endfor %}
  
   &lt;/body&gt;
  
     {% endblock %}
  </code></pre>
  
  <p>How can I go about this? I don't want to use haysatck due to some personal reasons.</p>