Commit 6a309017 authored by kylemendozaa's avatar kylemendozaa

created assignment detail view

parent d942df4c
{% extends 'base.html' %}
{% load static %}
{% block title %}Assignments{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'assignments.css' %}">
{% endblock %}
{% block content %}
<h1>{{ assignment.course.course_code }} {{ assignment.course.course_title }} {{ assignment.course.section }}</h1>
<h2>{{ assignment.name }}</h2>
<p>{{ assignment.description }}</p>
{% if assignment.id == 1 %}
<img src="{% static 'assignment1.jpg' %}">
{% elif assignment.id == 2 %}
<img src="{% static 'assignment2.jpg' %}">
{% else %}
<img src="{% static 'code.jpg' %}">
{% endif %}
<p>Perfect Score: <span>{{ assignment.max_points }}</span></p>
<p>Passing Score: <span>{{ assignment.passing_score }}</span></p>
{% endblock %}
\ No newline at end of file
......@@ -17,7 +17,7 @@
<ul>
{% for assignment in course.assignments.all %}
<li>
<a href="assignments/{{ assignment.id }}/details">{{ assignment.name }}</a>
<a href="/assignments/{{ assignment.id }}/details">{{ assignment.name }}</a>
</li>
{% endfor %}
</ul>
......
from django.urls import path
from .views import index
from .views import index, AssignmentDetailView
urlpatterns = [
path('', index, name='index'),
path('<int:pk>/details', AssignmentDetailView.as_view(), name='assignment-details')
]
app_name = 'assignments'
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.views.generic.detail import DetailView
from .models import Assignment, Course
......@@ -12,3 +13,6 @@ def index(request):
}
template = loader.get_template("assignments/index.html")
return HttpResponse(template.render(context, request))
class AssignmentDetailView(DetailView):
model = Assignment
\ 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