Commit 957e9902 authored by Adrian Lance Damalerio's avatar Adrian Lance Damalerio

commit

parents 3c75f2f5 f5883d1f
{% extends 'base.html'%}
{% block title %}
{% if assignment %}
{{assignment.title}}
{% else %}
<p>No Available assignment.</p>
{% endif %}
{% endblock %}
{% block content %}
{% if assignment %}
<h1>{{assignment.name}}</h1>
<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>
</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>
</ul>
{% endblock %}
\ No newline at end of file
{% extends 'base.html'%}
{% block title %}
Widget's Assignments
{% endblock %}
{% block content %}
<h1>Welcome to Widget's Assignments!</h1>
{% if assignments %}
<ul>
{% for assignment in assignments %}
<a href={{assignment.id}}/details>{{ assignment.name }}</a><br>
{% endfor %}
</ul>
{% else %}
<p>No Available Assignments.</p>
{% endif %}
<ul>
<li><button type="button" onclick="window.location.href='/books/add'">New Assignments</button></li>
<li><a href="/dashboard">Dashboard</a></li>
<li><a href="/announcements">Announcements</a></li>
<li><a href="/forum">Forum</a></li>
<li><a href="/calendar">Calendar</a></li>
</ul>
{% endblock %}
\ No newline at end of file
......@@ -3,5 +3,5 @@ from . import views
# url for assignments
urlpatterns = [
path('', views.assignmentIndex, name='assignmentIndex'),
path('', views.assignments_view, name='assignment'),
]
\ No newline at end of file
from django.http import HttpResponse
from django.shortcuts import render
from .models import Assignment
# assignment view from .models
def assignmentIndex(request):
title = "Widget's Assignments Page" + "<br><br>"
assignments = Assignment.objects.all()
output_view = ""
for assignment in assignments:
name = "Assignment Name: " + assignment.name + "<br>"
description = "Description: " + assignment.description + "<br>"
perfect_score = "Perfect Score: " + str(assignment.perfect_score) + "<br>"
passing_score = "Passing Score: " + str(assignment.passing_score) + "<br>"
course_section = "Course/Section: " + assignment.course.code + " " + assignment.course.title + "-" + assignment.course.section + "<br><br>"
output_view = output_view + name + description + perfect_score + passing_score + course_section
return HttpResponse(title + output_view)
\ No newline at end of file
# assignment view for FBV implementation.
def assignments_view(request):
assignments = Assignment.objects.all().order_by('id')
return render(request, 'assignments.html', {'assignments': assignments})
\ No newline at end of file
.row {
grid-row: 1 / span 2;
}
ul li {
list-style-type: none;
}
h1 {
font-size: 36px;
font-weight: bold;
margin: 0;
color: blue;
}
form {
background-color: blanchedalmond;
}
button {
background-color: #555;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
{% load static %}
<link rel="stylesheet" href="{% static 'styles.css' %}">
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<div class="container">
{% block content %}{% endblock %}
</div>
</body>
</html>
\ No newline at end of file
......@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
......@@ -57,18 +58,19 @@ MIDDLEWARE = [
]
ROOT_URLCONF = "widget_aguandhischipmunks.urls"
STATIC_URL = '/static/'
STATICFILES_DIRS = [BASE_DIR / "static"]
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
......
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