change assignment hub page, add individual assignment pages, add css

parent e528e1e3
# Generated by Django 4.0.3 on 2022-05-18 09:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assignments', '0004_alter_assignment_course'),
]
operations = [
migrations.AddField(
model_name='assignment',
name='post_imageUrl',
field=models.CharField(default=1, max_length=999),
),
]
# Generated by Django 4.0.3 on 2022-05-18 09:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('assignments', '0005_assignment_post_imageurl'),
]
operations = [
migrations.RenameField(
model_name='assignment',
old_name='post_imageUrl',
new_name='assignment_imageUrl',
),
]
# Generated by Django 4.0.3 on 2022-05-18 09:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assignments', '0006_rename_post_imageurl_assignment_assignment_imageurl'),
]
operations = [
migrations.AlterField(
model_name='assignment',
name='assignment_imageUrl',
field=models.CharField(blank=True, default=None, max_length=999, null=True),
),
]
...@@ -15,6 +15,7 @@ class Assignment(models.Model): ...@@ -15,6 +15,7 @@ class Assignment(models.Model):
description = models.CharField(max_length=500) description = models.CharField(max_length=500)
max_points = models.IntegerField() max_points = models.IntegerField()
passing_score = models.IntegerField(blank=True, null=True, editable=False) passing_score = models.IntegerField(blank=True, null=True, editable=False)
assignment_imageUrl = models.CharField(max_length=999,default=None,null=True,blank=True)
def __str__(self): def __str__(self):
return self.name return self.name
......
h1 {
font-family: 'Arial Black', 'Arial', sans-serif;
}
h2 {
font-family: 'Helvetica', 'Arial', sans-serif;
}
h3 {
font-family: 'Helvetica', 'Arial', sans-serif;
border: 2px solid white;
background-color: MidnightBlue;
color: white;
}
body {
background-color: Gainsboro;
font-family: 'Courier New', Courier, monospace;
}
ul {
font-family: 'Courier New', Courier, monospace;
font-weight: bold;
list-style-type: square;
background-color: DarkGray;
}
img {
max-height: 500px;
}
{% extends "assignments/base.html" %}
{% block content %}
<h3>{{assignment.course.course_code}} | {{assignment.course.course_title}} | {{assignment.course.section}}</h3>
<hr>
<img src= {{assignment.assignment_imageUrl}}>
<h2>{{assignment.name}}</h2>
Description: {{assignment.description}} <br>
Perfect Score: {{assignment.max_points}} <br>
Passing Score: {{assignment.passing_score}} <br>
{% endblock %}
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{% static 'assignments/style.css' %}">
<title></title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
{% extends "assignments/base.html" %}
{% block content %}
<h1>Assignments Per Course</h1>
{% if course_list %}
<ul>
{% for course in course_list %}
<li><h3>{{course.course_code}} | {{course.course_title}} | {{course.section}}</h3>
<ul>
{% for assignment in assignments %}
{% if assignment.course.course_code == course.course_code %}
<li><a href ="{% url 'assignment' assignment.id%}">{{assignment.name}}</a></li>
{% endif %}
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% else %}
<p>No courses currently enrolled.</p>
{% endif %}
{% endblock %}
...@@ -3,5 +3,6 @@ from django.urls import path ...@@ -3,5 +3,6 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name='index') path('', views.index, name='index'),
path("<int:assignment_id>/details/", views.assignments, name='assignment')
] ]
...@@ -4,10 +4,20 @@ from django.shortcuts import render ...@@ -4,10 +4,20 @@ from django.shortcuts import render
# Create your views here. # Create your views here.
def index(request): def index(request):
Assignments = Assignment.objects.all()
Courses = Course.objects.all()
course_list = Course.objects.order_by("course_code")
context ={ context ={
'assignments':Assignment.objects.all(), 'assignments':Assignments,
'courses':Course.objects.all() 'courses':Courses,
'course_list':course_list
} }
return render(request, "assignments/view.html", context)
return render(request, "assignment.html", context) def assignments(request, assignment_id):
course_list = Course.objects.order_by("course_code")
try:
assignment = Assignment.objects.get(pk=assignment_id)
except Assignment.DoesNotExist:
raise Http404("Assignment does not exist")
return render(request, "assignments/assignment.html",{"assignment": assignment, 'course_list':course_list})
No preview for this file type
# Generated by Django 4.0.3 on 2022-05-18 09:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_widgetuser_user_imageurl'),
]
operations = [
migrations.AlterField(
model_name='widgetuser',
name='user_imageUrl',
field=models.CharField(default=1, max_length=999),
),
]
h1 {
font-family: 'Courier New', Courier, monospace;
}
h3 {
font-family: 'Courier New', Courier, monospace;
border: 2px solid black;
background-color: azure;
}
body {
background-color: bisque;
}
ul {
font-family: 'Courier New', Courier, monospace;
list-style-type: square;
border: 5px solid black;
background-color: aliceblue;
}
img {
max-width: 500px;
}
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