Edited assignment views

parent df2c11c3
...@@ -11,15 +11,6 @@ class AssignmentsView(View): ...@@ -11,15 +11,6 @@ class AssignmentsView(View):
assignments_list = Assignment.objects.order_by("name") assignments_list = Assignment.objects.order_by("name")
return render(request, "assignments/assignments_list.html", {"course_list": course_list, "assignments_list": assignments_list}) return render(request, "assignments/assignments_list.html", {"course_list": course_list, "assignments_list": assignments_list})
# def index(request):
# course_list = Course.objects.order_by("course_code")
# assignments_list = Assignment.objects.order_by("name")
# context = {
# "course_list": course_list,
# "assignments_list": assignments_list,
# }
# return render(request, "assignments/assignments_list.html", context)
def detail(request, pk): def detail(request, pk):
assignment = Assignment.objects.get(pk=pk) assignment = Assignment.objects.get(pk=pk)
course = Course.objects.get(course_code__exact=assignment.course_code) course = Course.objects.get(course_code__exact=assignment.course_code)
...@@ -38,12 +29,3 @@ class AssignmentCreateView(CreateView): ...@@ -38,12 +29,3 @@ class AssignmentCreateView(CreateView):
if form.is_valid(): if form.is_valid():
new_assignment = form.save() new_assignment = form.save()
return redirect("assignments:add-assignment") return redirect("assignments:add-assignment")
# def newassignment(request):
# if request.method == "POST":
# assignment_form = AssignmentForm(request.POST)
# if assignment_form.is_valid():
# new_assignment = assignment_form.save()
# return redirect("assignments:add-assignment")
# else:
# assignment_form = AssignmentForm()
# return render(request, "assignments/add_assignment.html", {"assignment_form": assignment_form})
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