views has been modified for the data to be shown and appearance of app has been organized.

parent 6ca0f9df
......@@ -5,15 +5,15 @@ from .models import Assignment, Course
# 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)
head_string = "<h1>Widget's Assignment Page</h1>"
body_string = ""
for assignment in Assignment.objects.all():
body_string += '<p>Assignment Name: {}</br>'.format(assignment.name)
body_string += 'Description: {}</br>'.format(assignment.description)
body_string += 'Perfect Score: {}</br>'.format(assignment.perfect_score)
body_string += 'Passing Score: {}</br>'.format(assignment.passing_score)
body_string += 'Course/Section: {} {}-{}</br>'.format(assignment.course.code, assignment.course.title, assignment.course.section)
body_string += "</p>"
html_string = '<html><head>{}</head><body>{}</body></html>'.format(head_string, body_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