Commit dd8a9867 authored by Brescia Amandy's avatar Brescia Amandy

Edited the template for the Assignments Page

parent 8b129c30
{% extends 'base.html' %} {% extends 'base.html' %}
\ No newline at end of file
{% block title %}Widget's Assignments{% endblock %}
{% block header %}Welcome to Widget's Assignments{% endblock %}
{% block body %}
<ul>
{% for assignment in assignment_list %}
<li>
<a href='#'>
{{ assignment.name }}
</a>
</li>
{% endfor %}
</ul>
<a href="add">New Assignment</a> <br/>
<a href="#">Dashboard</a> <br/>
<a href="#">Forum</a>
{% endblock %}
\ No newline at end of file
...@@ -2,11 +2,14 @@ from django.shortcuts import render ...@@ -2,11 +2,14 @@ from django.shortcuts import render
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView from django.views.generic.edit import CreateView, UpdateView
from .models import Assignment, Course
from .models import Assignment
def assignments(request): def assignments(request):
return render(request, 'assignments/assignments.html') context = {}
context["assignment_list"] = Assignment.objects.all()
return render(request, 'assignments/assignments.html', context)
class AssignmentDetails(DetailView): class AssignmentDetails(DetailView):
model = Assignment model = Assignment
...@@ -15,7 +18,11 @@ class AssignmentDetails(DetailView): ...@@ -15,7 +18,11 @@ class AssignmentDetails(DetailView):
class AssignmentAdd(CreateView): class AssignmentAdd(CreateView):
model = Assignment model = Assignment
template_name = 'assignments/assignment-add.html' template_name = 'assignments/assignment-add.html'
fields = ['name', 'description', 'course', 'perfect_score',] fields = [
'name',
'description',
'course',
'perfect_score',]
class AssignmentEdit(UpdateView): class AssignmentEdit(UpdateView):
model = Assignment model = Assignment
......
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