title: Django - Get model's children when really the child has its parent's foreign key
body: <p>I have a small issue, which I know must be easy...however, I can't seem to find the best way to do this, preferably in one query in my view.</p>
  
  <pre><code>class Category(models.Model):
      ...
  
  class SubCategory(models.Model):
      category = models.ForeignKey(Category)
      ...
  </code></pre>
  
  <p>I am able to get the subcategories and categories in <strong>one query</strong> like so, but it's not really what I need:</p>
  
  <pre><code>...
  subcategories = SubCategory.objects.select_related('category')
  subcategories = subcategories.filter(is_active=True)
  </code></pre>
  
  <p>What I really need is the reverse so I get all Categories and their associated Subcategories, but I have no idea how to do that as the Category object does not have a foreign key reference to Subcategory as a many to many...it's set up like that for a reason. (Note: It's set up this way since I have my Subcategories inline on the Category admin so I can add subcategories while on the Category add/edit and can drag and drop the subcategories in my preferred order).</p>
  
  <p>I'd want something like this, just sudo output structure:</p>
  
  <pre><code>&lt;Category object&gt;
      &lt;SubCategory object&gt;
      &lt;SubCategory object&gt;
      &lt;SubCategory object&gt;
  &lt;Category object&gt;
      &lt;SubCategory object&gt;
      &lt;SubCategory object&gt;
      &lt;SubCategory object&gt;
  &lt;Category object&gt;
      &lt;SubCategory object&gt;
      &lt;SubCategory object&gt;
      &lt;SubCategory object&gt;
  ....
  </code></pre>
  
  <p>Can anyone point me in the right direction?  Any help is appreciated.  Thanks in advance.</p>