Added views for assignments on assignments page

parent 8dc6d87b
from django.http import HttpResponse
from .models import Assignment
# Create your views here.
def index(request):
return HttpResponse("This is the Assignments page!")
\ No newline at end of file
return HttpResponse(display_assignments(Assignment.objects.all()))
def display_assignments(data_set_assignment):
display_output = "ASSIGNMENTS: <br>"
for object in data_set_assignment:
display_output += '''
Assignment Name: {name}<br>
Description: {description}<br>
Perfect Score: {max_points}<br>
Passing Score: {passing_score}<br>
Course/Section: {course_code} | {course_title} - {section}<br><br>
'''.format(name = object.name,
description = object.description,
max_points = object.max_points,
passing_score = object.passing_score,
course_code = object.course.course_code,
course_title = object.course.course_title,
section = object.course.section)
return display_output
\ 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