title: search database from multiple form fields
body: <p>I have the following case. I have a form with 3 fields which are submitted with POST method. Then the fields are captured and a search using Q is made on the database:</p>
  
  <pre><code>query = Model.objects.filter( Q(field1=field1) &amp; Q(field2=field2) &amp; Q(field3=field3))
  </code></pre>
  
  <p>The problem is that I would like to dynamically use the fields that are filled not the empty ones. That means that the query will contain one or two or three criteria depending on the user.</p>
  
  <p>I have managed to perform the search I describe with nested <code>if</code> but considering adding extra fields it gets bigger and bigger.</p>
  
  <p>thanks  </p>