title: Django filtering with kwargs
body: <p>I have the following code.</p>
  
  <pre><code>def alpha(**kwargs):
      q_obj_list = [Q(str(i), kwargs.get(i)) for i in kwargs.keys()]
      reduce(operator.and_, q_obj_list)
      return q_obj_list
  
  q = Elements.objects.all()
  q = q.filter(alpha(id=1, is_active=False))
  </code></pre>
  
  <p>For this code I am receiving an error saying TypeError: 'bool' object has no attribute '<strong>getitem</strong>'. I was intending to replace the below code with this.  </p>
  
  <pre><code>q = Elements.objects.all()
  id = kwargs.get("id")
  active = kwargs.get("is_active")
  q.filter(id=id,is_active=active)
  </code></pre>
  
  <p>How to I fix such an error ?</p>