Proper HttpResponse has been implemented.

parent eff8d7c6
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse
from .models import Assignment, Course
# Create your views here. # Create your views here.
def index(request):
return_string = '<ul>'
return_string += "Widget's Assignment Page"
for post in Assignment.objects.all():
return_string += '<li>Assignment Name: {}</li>'.format(Assignment.name)
return_string += '<li>Description: {}</li>'.format(Assignment.description)
return_string += '<li>Perfect Score: {}</li>'.format(Assignment.perfect_score)
return_string += '<li>Passing Score: {}</li>'.format(Assignment.passing_score)
return_string += '<li>Course/Section: {} {}-{}</li>'.format(Course.code, Course.title, Course.section)
return_string += '</ul>'
html_string = '<html><body>{}</body></html>'.format(return_string)
return HttpResponse(html_string)
\ No newline at end of file
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