Get nested/related objects in a Django template
<p>I've 2 tables (categories, articles), in my view i set:</p>

<pre><code>categories = Category.objects.filter(site=4)
</code></pre>

<p>and I can use it in my template with </p>

<pre><code>{% for cat in categories %}
</code></pre>

<p>but the output is:</p>

<p>-> category 1</p>

<p>-> category 2</p>

<p>-> category 3</p>

<p>how can I get articles for each category like this output?</p>

<p><strong>-> category 1</strong></p>

<p>---> article 1</p>

<p>---> article 2</p>

<p><strong>-> category 2</strong></p>

<p>---> article 1</p>

<p>---> article 2</p>