Commit 590d90d4 authored by Deokhyun Lee's avatar Deokhyun Lee

view is implemented and properly shows the content

parent 34daae9e
from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from .models import Assignment, Course
# Create your views here. # Create your views here.
def index(request): def index(request):
return HttpResponse("Welcome assignments") title = "Widget's Assignments Page" + "<br><br>"
\ No newline at end of file assignments = Assignment.objects.all()
# courses = Course.objects.all()
output_view = ""
for assignment in assignments:
name = "Assignment Name: " + assignment.name + "<br>"
description = "Description: " + assignment.description + "<br>"
perfect_score = "Perfect Score: " + str(assignment.perfect_score) + "<br>"
passing_score = "Passing Score: " + str(assignment.passing_score) + "<br>"
course_section = "Course/Section: " + assignment.course.code + " " + assignment.course.title + "-" + assignment.course.section + "<br><br>"
output_view = output_view + name + description + perfect_score + passing_score + course_section
return HttpResponse(title + output_view)
\ 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