chore: change index page in assignment app from fbv to cbv

parent b3b95eda
......@@ -3,11 +3,11 @@
{% block content %}
<h1> {{assignment.course.course_code}} {{assignment.course.course_title}} {{assignment.course.section}} </h1>
<p>
<p id = "detail">
{{assignment.name}} <br>
{{assignment.description}} <br>
{{assignment.max_points}} <br>
{{assignment.passing_score}} <br>
Highest Possible Score: {{assignment.max_points}} <br>
Passing Score: {{assignment.passing_score}} <br>
{% if assignment.image %}
<img src="{{ assignment.image.url }}">
......
from django.urls import path, include
from . import views
from .views import AssignmentsPageView
urlpatterns = [
path('', views.index, name = 'index'),
path('', AssignmentsPageView.as_view(), name = 'index'),
#assignments/1/details
path("<int:assignment_id>/details/", views.detail, name='detail'),
#assignments/add
......
from msilib.schema import ListView
from unicodedata import name
from django.http import Http404, HttpResponse
from django.shortcuts import render, redirect
from django.views import View
from .models import Course, Assignment
from .forms import AssignmentForm
# Create your views here.
def index(request):
class AssignmentsPageView(View):
def get(self, request):
course_list = Course.objects.order_by("course_code")
context = {
'course_list': course_list
}
return render(request, "assignments/index.html", context)
return render(request, 'assignments/index.html', context)
def detail(request, assignment_id):
try:
......
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