title: Display objects and their foreign key objects
body: <p>Need some help with displaying data. </p>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>class Brand(models.Model):
      name = models.CharField(max_length=100)
  
      def __str__(self):
          return self.name
  
  class Car(models.Model):
      name = models.CharField(max_length=100)
      brand = models.ForeignKey(Brand, related_name='brands', on_delete=models.CASCADE)
  
      def __str__(self):
          return self.brand.name + " - " + self.name
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def car_view(request):
  
      # pls halp
  </code></pre>
  
  <p>How to display list of Brands and after each brand a list of cars? Example is shown below.</p>
  
  <pre><code>&lt;html&gt;
      &lt;ul&gt;
      &lt;li&gt;Toyota&lt;/li&gt;
      &lt;ul&gt;
          &lt;li&gt;Corolla&lt;/li&gt;
          &lt;li&gt;Avensis&lt;/li&gt;
          &lt;li&gt;Yaris&lt;/li&gt;
      &lt;/ul&gt;
      &lt;li&gt;Volkswagen&lt;/li&gt;
      &lt;ul&gt;
          &lt;li&gt;Golf&lt;/li&gt;
          &lt;li&gt;Transporter&lt;/li&gt;
          &lt;li&gt;Passat&lt;/li&gt;
      &lt;/ul&gt;
      &lt;/ul&gt;
  &lt;/html&gt;
  </code></pre>