title: How to use inverse of a GenericRelation
body: <p>I must be really misunderstanding something with the <a href="https://docs.djangoproject.com/en/1.7/ref/contrib/contenttypes/#reverse-generic-relations" rel="noreferrer"><code>GenericRelation</code> field</a> from Django's content types framework.</p>
  
  <p>To create a minimal self contained example, I will use the polls example app from the tutorial.  Add a generic foreign key field into the <code>Choice</code> model, and make a new <code>Thing</code> model:</p>
  
  <pre><code>class Choice(models.Model):
      ...
      content_type = models.ForeignKey(ContentType)
      object_id = models.PositiveIntegerField()
      thing = GenericForeignKey('content_type', 'object_id')
  
  class Thing(models.Model):
      choices = GenericRelation(Choice, related_query_name='things')
  </code></pre>
  
  <p>With a clean db, synced up tables, and create a few instances:</p>
  
  <pre><code>&gt;&gt;&gt; poll = Poll.objects.create(question='the question', pk=123)
  &gt;&gt;&gt; thing = Thing.objects.create(pk=456)
  &gt;&gt;&gt; choice = Choice.objects.create(choice_text='the choice', pk=789, poll=poll, thing=thing)
  &gt;&gt;&gt; choice.thing.pk
  456
  &gt;&gt;&gt; thing.choices.get().pk
  789
  </code></pre>
  
  <p>So far so good - the relation works in both directions from an instance.  But from a queryset, the reverse relation is very weird:</p>
  
  <pre><code>&gt;&gt;&gt; Choice.objects.values_list('things', flat=1)
  [456]
  &gt;&gt;&gt; Thing.objects.values_list('choices', flat=1)
  [456]
  </code></pre>
  
  <p>Why the inverse relation gives me again the id from the <code>thing</code>?  I expected instead the primary key of the choice, equivalent to the following result:</p>
  
  <pre><code>&gt;&gt;&gt; Thing.objects.values_list('choices__pk', flat=1)
  [789]
  </code></pre>
  
  <p>Those ORM queries generate SQL like this:</p>
  
  <pre><code>&gt;&gt;&gt; print Thing.objects.values_list('choices__pk', flat=1).query
  SELECT "polls_choice"."id" FROM "polls_thing" LEFT OUTER JOIN "polls_choice" ON ( "polls_thing"."id" = "polls_choice"."object_id" AND ("polls_choice"."content_type_id" = 10))
  &gt;&gt;&gt; print Thing.objects.values_list('choices', flat=1).query
  SELECT "polls_choice"."object_id" FROM "polls_thing" LEFT OUTER JOIN "polls_choice" ON ( "polls_thing"."id" = "polls_choice"."object_id" AND ("polls_choice"."content_type_id" = 10))
  </code></pre>
  
  <p>The Django docs are generally excellent, but I can't understand why the second query or find any documentation of that behaviour - it seems to return data from the wrong table completely?</p>