title: django : using Q objects
body: <p>I have these 2 queries :</p>
  
  <pre><code>gifts = Products.objects \
      .filter(entry_query,in_stock__icontains='A-in') \
      .filter(~Q(title__icontains='Not Found'))
  </code></pre>
  
  <p>and</p>
  
  <pre><code>gifts1 = Products.objects \
      .filter(('city__name__iregex', 'Delhi'),in_stock__icontains='A-in') \
      .filter(~Q(title__icontains='Not Found'))
  </code></pre>
  
  <p>If I do <code>gifts = gifts | gifts1</code> I get the following error: </p>
  
  <blockquote>
    <p>error user-defined function raised exception</p>
  </blockquote>
  
  <p>If i use Q objects like this:</p>
  
  <pre><code>gifts = Products.objects \
      .filter((Q(entry_query) &amp; Q(in_stock__icontains='A-in')) | Q(('city__name__iregex', 'Delhi'),in_stock__icontains='A-in') ) \
      .filter(~Q(title__icontains = 'Not Found'))
  </code></pre>
  
  <p>I again get the same error</p>
  
  <p>Here entry query is </p>
  
  <pre><code>(OR: ('title__iregex', u'bag'), ('description__iregex', u'bag'),('source_website_url__iregex', u'bag'))
  </code></pre>
  
  <p>Can someone please tell me where am I going wrong</p>