title: Django filter queryset on "tuples" of values for multiple columns
body: <p>Say I have a model:</p>
  
  <pre><code>Class Person(models.Model):
      firstname = models.CharField()
      lastname = models.CharField()
      birthday = models.DateField()
      # etc...
  </code></pre>
  
  <p>and say I have a list of 2 first names: <code>first_list = ['Bob', 'Rob']</code> And I have a list of 2 last names: <code>last_list = ['Williams', 'Williamson']</code>.  Then if I wanted to select everyone whose first name was in <code>first_list</code> I could run:</p>
  
  <pre><code>Person.objects.filter(firstname__in=first_list)
  </code></pre>
  
  <p>and if I wanted to select everyone whose last name was in <code>last_list</code>, I could do:</p>
  
  <pre><code>Person.objects.filter(lastname__in=last_list)
  </code></pre>
  
  <p>So far, so good.  If I want to run both of those restrictions at the same time, that's easy...</p>
  
  <pre><code>Person.objects.filter(firstname__in=first_list, lastname__in=last_list)
  </code></pre>
  
  <p>If I wanted to do the <code>or</code> style search instead of the <code>and</code> style search, I can do that with <code>Q</code> objects:</p>
  
  <pre><code>Person.objects.filter(Q(firstname__in=first_list) | Q(lastname__in=last_name))
  </code></pre>
  
  <p>But what I have in mind is something a bit more subtle.  What if I just want to return a queryset that returns specific combinations of first and last names?  I.e. I want to return the <code>Person</code> objects for which <code>(Person.firstname, Person.lastname)</code> is in <code>zip(first_names, last_names)</code>.  I.e. I want to get back anyone named the Bob Williams or Rob Williamson (but not anyone named Bob Williamson or Rob Williams).  </p>
  
  <p>In my actual use case, <code>first_list</code> and <code>last_list</code> would both have ~100 elements.</p>
  
  <p>At the moment, I need to solve this problem in a Django app.  But I am also curious about the best way to handle this in a more general SQL context.</p>
  
  <p>Thanks!  (And please let me know if I can clarify anything.)</p>