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

url pattern for details updated

parent f5883d1f
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
<ul> <ul>
<h2>{{assignment.course.code}} {{assignment.course.title}} - {{assignment.course.section}} </h2> <h2>{{assignment.course.code}} {{assignment.course.title}} - {{assignment.course.section}} </h2>
<br> <br>
<h2>Description: {{assignment.description}}</h2><br> <p>Description: {{assignment.description}}</p><br>
<h2>Description: {{assignment.description}}</h2><br> <p>Perfect Score: {{assignment.perfect_score}}</p><br>
<h2>Description: {{assignment.description}}</h2><br> <p>Passing Score: {{assignment.passing_score}}</p><br>
</ul> </ul>
{% else %} {% else %}
<p>No Available Books.</p> <p>No Available Books.</p>
{% endif %} {% endif %}
<ul> <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> </ul>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -4,4 +4,5 @@ from . import views ...@@ -4,4 +4,5 @@ from . import views
# url for assignments # url for assignments
urlpatterns = [ urlpatterns = [
path('', views.assignments_view, name='assignment'), 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 django.shortcuts import render
from .models import Assignment from .models import Assignment
from django.views.generic import DetailView
# assignment view for FBV implementation. # assignment view for FBV implementation.
def assignments_view(request): def assignments_view(request):
assignments = Assignment.objects.all().order_by('id') assignments = Assignment.objects.all().order_by('id')
return render(request, 'assignments.html', {'assignments': assignments}) return render(request, 'assignments.html', {'assignments': assignments})
\ No newline at end of file
# 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