title: Django model filter on list of dictionaries
body: <p>I would like to filter a tabel on two values. On of which is the highest existing version of the first. First I get these two values from the first model.</p>
  
  <pre><code>latest_versions = Version.objects.values('post').annotate(version=Max('version'))
  </code></pre>
  
  <p>This gives me a list of dictionaries, which contains the post names with their latest version.</p>
  
  <pre><code>[{name: xxx, version: 1.2}{name: yyy, version: 3.4}]
  </code></pre>
  
  <p>Now I would like to use this list of dictionaries (latest_versions) as a filter on another table which has columns which are named <em>name</em> and <em>version</em>. </p>
  
  <p>I thought this might work:</p>
  
  <pre><code>Post.objects.filter(**latest_versions)
  </code></pre>
  
  <p>But it doesn't, because it's a ValueQuerySet, a list of dictionaries. But if I iterate over the ValueQuerySet it works, but I have to make a DB call for every instance.</p>
  
  <pre><code>for latest_version in latestversions:
      r = Post.objects.filter(**latest_version)
      result = result + list(r)
  </code></pre>
  
  <p>What's the Pythonic way to go?</p>
  
  <p>Thanks in advance.</p>