class Car(models.Model):
manufacturer = models.ForeignKey('Manufacturer')
# ...
class Manufacturer(models.Model):
# ...
pass
{% for manufacturer, cars in car_list %}
<h1>{{ manufacturer.name }}</h1>
{% for car in cars %}
<p>{{ car.name }}</p>
{% endfor %}
{% endfor %}
manufacturer = models.ForeignKey('Manufacturer', related_name='cars')
m = Manufacturer.objects.filter(...)
{% for man in m %}
<h1>{{ man.name }}</h1>
{% for car in man.cars.all %}
<p>{{ car.name }}</p>
{% endfor %}
{% endfor %}