Commit 9e45f431 authored by Deokhyun Lee's avatar Deokhyun Lee

url pattern for details updated

parent f5883d1f
......@@ -14,15 +14,15 @@
<ul>
<h2>{{assignment.course.code}} {{assignment.course.title}} - {{assignment.course.section}} </h2>
<br>
<h2>Description: {{assignment.description}}</h2><br>
<h2>Description: {{assignment.description}}</h2><br>
<h2>Description: {{assignment.description}}</h2><br>
<p>Description: {{assignment.description}}</p><br>
<p>Perfect Score: {{assignment.perfect_score}}</p><br>
<p>Passing Score: {{assignment.passing_score}}</p><br>
</ul>
{% else %}
<p>No Available Books.</p>
{% endif %}
<ul>
<li ><button type="button" onclick="window.location.href='/assignments/{{assignments.pk}}/edit'">Edit Assignments</button></li>
<li ><button type="button" onclick="window.location.href='/assignments/{{assignment.pk}}/edit'">Edit Assignments</button></li>
</ul>
{% endblock %}
\ No newline at end of file
......@@ -4,4 +4,5 @@ from . import views
# url for assignments
urlpatterns = [
path('', views.assignments_view, name='assignment'),
path('<int:pk>/details', views.AssignmentDetailView.as_view(), name='assignment_detail'),
]
\ No newline at end of file
from django.shortcuts import render
from .models import Assignment
from django.views.generic import DetailView
# assignment view for FBV implementation.
def assignments_view(request):
assignments = Assignment.objects.all().order_by('id')
return render(request, 'assignments.html', {'assignments': assignments})
# assignement Detail view for CBV implementation.
class AssignmentDetailView(DetailView):
model = Assignment
template_name = 'assignment-details.html'
context_object_name = '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