Django - joining two many-to-one relationships
<p>I am stuck trying to write a Django ORM query to get the analogue of the following query:</p>

<pre><code>vendors = Vendors.objects.select_related('legal_entities') #....and then I want to also get legal_entities_details
</code></pre>

<p>My model:</p>

<pre><code>  class LegalEntitiesDetails(models.Model):
        legal_entities = models.ForeignKey(LegalEntities, models.CASCADE)
    class LegalEntities(models.Model):
        #...Some fields
    class Vendors(models.Model):
        legal_entities = models.ForeignKey(LegalEntities, on_delete=models.CASCADE)
</code></pre>

<p>I can't figure out how to do it via select_related.  The problem as you see is that I can't write a simple chained selected_related because both vendors and legal_entities_details relate to legal_entities. Please bear with me with this question, I am a newbie to Django.</p>