Commit 6a5d4bd8 authored by Emmanuel Linus T. Evangelista's avatar Emmanuel Linus T. Evangelista

Merge branch 'tan/assignments'

parents 592cf44e b42f2948
File deleted
*{
border: 0;
margin: 0;
color: #624741;
}
body {
font-family: 'Inter', sans-serif;
background-color: #F9F5F0;
}
#header h1 {
color: #F9F5F0;
padding: 1em;
text-align: right;
font-size: 15px;
font-weight: 300;
background-color: #624741
}
#courses h1{
padding: 1.2em 1em;
color: #624741;
font-size: 70px;
font-family: 'Inter', sans-serif;
}
ul{
padding: 0;
}
li {
list-style-position: inside;
padding-top: 14px;
}
.block{
padding: 1em;
border: 0.5px;
border-style: solid;
}
.block h2{
padding: 0.2em;
border-bottom: 1px #624741;
border-style: solid;
font-size: 24px;
}
.wrapper{
display:grid;
grid-template-columns:repeat(3, 1fr);
grid-auto-rows: minimax(100px, auto);
}
a:hover{
color: #e89a64;
}
#details{
padding: 5em;
}
#details h5{
font-size: 20px;
font-weight: 500;
}
#details h3{
font-size: 80px;
padding-bottom: 2em;
}
#details h4{
font-size: 20px;
font-weight: 500;
}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block styles %} <link rel = "stylesheet" href="{% static 'css/index.css' %}"> {% endblock %}
{% block title %} {{object.course}} {% endblock title%}
{% block content %}
<div id = "header">
<h1> Course: {{object.course}} </h1>
</div>
<div id = "details">
<img src="{%static 'images/jokebear.png'%}">
<h5> Assignment Name: </h5>
<h3>{{object.name}} </h3>
<h4> <b>Assignment Description:</b> {{object.description}} </h4>
<h4> <b>Perfect Score:</b> {{object.max_points}} </h4>
<h4> <b>Passing Score:</b> {{object.passing_score}} </h4>
{%endblock content%}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{ % block styles %}
{ % endblock styles %}
{% block title %} Assignments {% endblock title%}
{% block content %}
<div id = "header">
</div>
<div id = "courses">
<ul>
<div class = "wrapper">
{% for a in assignments %}
<div class = "block">
<h2> {{a.course}} </h2>
<li>
<a href="{% url 'Assignments:assignment-detail' a.pk%}"> {{a.name}} </a>
</li>
</div>
{%endfor%}
</div>
</ul>
</div>
{%endblock content%}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link rel = "stylesheet" href="{% static 'css/index.css' %}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@200;500;900&display=swap" rel="stylesheet">
{% endblock %}
{% block title %} Assignments {% endblock title%}
{% block content %}
<div id = "header">
<h1> Assignments per course </h1>
</div>
<div id = "courses">
<h1> List of courses: </h1>
</div>
{% include "Assignments/assignment_list.html" with assignments=assignment %}
{%endblock content%}
\ No newline at end of file
from django.urls import path from django.urls import path
from . import views from . import views
from .views import MainView, AssignmentListView, AssignmentDetailView
urlpatterns = [ urlpatterns = [
path('', views.index, name='index') path('', MainView.as_view(), name='index'),
path('assignment', AssignmentListView.as_view(), name='assignment-list'),
path('assignment/<int:pk>/details', AssignmentDetailView.as_view(), name ='assignment-detail'),
] ]
app_name = 'Assignments' app_name = 'Assignments'
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.views import View
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from .models import Assignment, Course from .models import Assignment, Course
def index(request): class MainView(View):
def get(self, request):
course = Course.objects.all().order_by('course_code')
assignment = Assignment.objects.all().order_by('course')
return render(request, 'index.html',{
'course': course,
'assignment': assignment,
})
print = "ASSIGNMENTS: " class AssignmentListView(ListView):
assignments = Assignment.objects.all() model = Assignment
for i in assignments:
print += f"<br /> Assignment name: {i.name} <br /> Description: {i.description} <br /> Perfect score: {i.max_points} <br /> Passing score: {i.passing_score} <br /> Course/Section: {i.course} <br />"
return HttpResponse(print)
class AssignmentDetailView(DetailView):
model = Assignment
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