from django.shortcuts import render from django.http import HttpResponse from django.template import loader from .models import Match def index(request): matches = Match.objects.order_by('-court') template = loader.get_template('scores/index.html') context = { 'matches': matches, } return HttpResponse(template.render(context, request))