Create assignments.html and change views.py to render the template

parent 157ca37f
{% block content %}
<h1>ASSIGNMENTS: </h1>
{% for assignment in assignments %}
<div class = "assignments">
<div class = "all_assignments">
<p>Assignment Name: {{ assignment.name }}</p>
<p>Description: {{ assignment.description }}</p>
<p>Perfect Score: {{ assignment.max_points }}</p>
<p>Passing Score: {{ assignment.passing_score }}</p>
<p>Course/Section: {{ assignment.course.course_code }}
{{ assignment.course.course_title }}
{{ assignment.course.section }}</p>
<br>
</div>
</div>
{% endfor %}
{% endblock %}
from django.shortcuts import render from django.shortcuts import render
from . import models
from django.http import HttpResponse from django.http import HttpResponse
# Create your views here. # Create your views here.
def assignments(request): def index(request):
return HttpResponse("This is the Assignments page!") return HttpResponse("This is the Assignments page!")
def assignments(request):
all_assignments = models.Assignment.objects.all()
return render(request, 'assignments.html', {'assignments': all_assignments})
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