Django select_related on multitable inheritance
<p>I'm tring to use <code>select_related</code> on multi-table inheritance lookup.<br>
My code has some drawbacks and wonder if there are better solution</p>

<pre><code>class Parent(models.Model):

    user = models.ForeignKey(settings.AUTH_USER_MODEL)


class Child(models.Model):

    pass
</code></pre>

<p>With the above class definition, I'd like to serialize parents (heterogeneous)</p>

<pre><code>parents = Parent.objects.all().select_related('user', 'child')

for parent in parents:
    parent.child.user           # &lt;-- another db access, nullifies select_related('user')
    # i'm passing parent.child to ChildSerializer() which expects child object, and it access the user, so it's parent.child.user
</code></pre>

<p>I can do</p>

<pre><code>Parent.objects.all().selecte_related('child__user')
</code></pre>

<p>but it has its own problem when there are multiple child models (it needs join for each child class)</p>