Commit 6c4e976c authored by Albert Gagalac's avatar Albert Gagalac

added new .html files + implemented assignment-detail.html features

parent 16b73a14
{% extends 'base.html' %}
{% load static %}
{% block title %} {{assignment}} {% endblock %}
{% block content %}
<h2>{{assignment}}</h2>
<h3>{{assignment.course}}</h3>
<p>
Description: {{assignment.description}}<br>
Perfect Score: {{assignment.perfect_score}}<br>
Passing Score: {{assignment.passing_score}}<br>
</p>
{% endblock %}
\ No newline at end of file
<p>{{"Widget's Assignments Page"}}<br><br></p> {% extends 'base.html' %}
{% load static %}
{% block content %}
<h2>{{assignment.name}}</h2>
<h3>{{assignment.course}}</h3>
{% for data in assignment %} {% for data in assignment %}
<p> <p>
Assignment name: {{data.name}}<br>
Description: {{data.description}}<br> Description: {{data.description}}<br>
Perfect Score: {{data.perfect_score}}<br> Perfect Score: {{data.perfect_score}}<br>
Passing Score: {{data.passing_score}}<br> Passing Score: {{data.passing_score}}<br>
Course/Section: {{data.course}}<br>
</p> </p>
{% endfor %} {% endfor %}
{% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import pageview from .views import pageview, AssignmentDetailView
urlpatterns = [ urlpatterns = [
path('', pageview, name='pageview') path('', pageview, name='pageview'),
path('<int:pk>/details', AssignmentDetailView.as_view(), name='assignment-details')
] ]
app_name = "assignments" app_name = "assignments"
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from .models import Assignment, Course from .models import Assignment, Course
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView
def pageview(request): def pageview(request):
num_assignment = Assignment.objects.all() all_assignment = Assignment.objects.all()
num_course = Course.objects.all() all_course = Course.objects.all()
return render(request, 'assignments/assignments.html', {'assignment': num_assignment, 'course': num_course}) return render(request, 'assignments/assignments.html', {'assignment': all_assignment, 'course': all_course})
class AssignmentDetailView(DetailView):
def get(self, request, pk):
assignment = Assignment.objects.get(pk=pk)
course = assignment.course
return render(request, 'assignments/assignment-details.html', {'assignment': assignment, 'course': course})
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