Get your own Django server
template.html
views.py
 
<!DOCTYPE html>
<html>
<body>

{% for x in cars %}
  {% ifchanged x.brand %}
    <h1>{{ x.brand }}:</h1>
  {% endifchanged %}
  <p>{{ x.model }}, {{ x.year }}</p>
{% endfor %}

<p>Check out views.py to see what the cars object look like.</p>

</body>
</html>                  
from django.http import HttpResponse
from django.template import loader

def testing(request):
  template = loader.get_template('template.html')
  context = {
    'cars': [
      {
        'brand': 'Ford',
        'model': 'Mustang',
        'year': '1964',
      },
      {
        'brand': 'Ford',
        'model': 'Bronco',
        'year': '1970',
      },
      {
        'brand': 'Ford',
        'model': 'Sierra',
        'year': '1981',
      },
      {
        'brand': 'Volvo',
        'model': 'XC90',
        'year': '2016',
      },
      {
        'brand': 'Volvo',
        'model': 'P1800',
        'year': '1964',
      }]
    }
  return HttpResponse(template.render(context, request))   
                  
127.0.0.1:8000/testing