Use HttpResponse to return data instead of render

parent 2565a40e
from django.shortcuts import render
from . import models
from django.http import HttpResponse
from django.template import Template, Context
from django.template.loader import get_template
# Create your views here.
def index(request):
......@@ -8,4 +10,6 @@ def index(request):
def assignments(request):
all_assignments = models.Assignment.objects.all()
return render(request, 'assignments.html', {'assignments': all_assignments})
template = get_template('assignments.html')
output = template.render({'assignments': all_assignments})
return HttpResponse(output)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment