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 ...@@ -5,15 +5,15 @@ from .models import Assignment, Course
# Create your views here. # Create your views here.
def index(request): def index(request):
return_string = '<ul>' head_string = "<h1>Widget's Assignment Page</h1>"
return_string += "Widget's Assignment Page" body_string = ""
for post in Assignment.objects.all(): for assignment in Assignment.objects.all():
return_string += '<li>Assignment Name: {}</li>'.format(Assignment.name) body_string += '<p>Assignment Name: {}</br>'.format(assignment.name)
return_string += '<li>Description: {}</li>'.format(Assignment.description) body_string += 'Description: {}</br>'.format(assignment.description)
return_string += '<li>Perfect Score: {}</li>'.format(Assignment.perfect_score) body_string += 'Perfect Score: {}</br>'.format(assignment.perfect_score)
return_string += '<li>Passing Score: {}</li>'.format(Assignment.passing_score) body_string += 'Passing Score: {}</br>'.format(assignment.passing_score)
return_string += '<li>Course/Section: {} {}-{}</li>'.format(Course.code, Course.title, Course.section) body_string += 'Course/Section: {} {}-{}</br>'.format(assignment.course.code, assignment.course.title, assignment.course.section)
return_string += '</ul>' body_string += "</p>"
html_string = '<html><body>{}</body></html>'.format(return_string) html_string = '<html><head>{}</head><body>{}</body></html>'.format(head_string, body_string)
return HttpResponse(html_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