title: Constructing Django filter queries dynamically with args and kwargs
body: <p>I'm constructing some Django filter queries dynamically, <a href="http://www.nomadjourney.com/2009/04/dynamic-django-queries-with-kwargs/">using this example</a>: </p>
  
  <pre><code>kwargs = { 'deleted_datetime__isnull': True }
  args = ( Q( title__icontains = 'Foo' ) | Q( title__icontains = 'Bar' ) )
  entries = Entry.objects.filter( *args, **kwargs )
  </code></pre>
  
  <p>I'm just not sure how to construct the entry for <code>args</code>. Say I have this array:</p>
  
  <pre><code>strings = ['Foo', 'Bar']
  </code></pre>
  
  <p>How do I get from there to:</p>
  
  <pre><code>args = ( Q( title__icontains = 'Foo' ) | Q( title__icontains = 'Bar' ) 
  </code></pre>
  
  <p>The closest I can get is:</p>
  
  <pre><code>for s in strings:
      q_construct = Q( title__icontains = %s) % s
      args.append(s)
  </code></pre>
  
  <p>But I don't know how to set up the <code>|</code> condition. </p>