Commit cbf222b7 authored by Sumawang, Tee Jay Jr. C.'s avatar Sumawang, Tee Jay Jr. C.

pycache!!

parents 351e21e6 9599c99a
widget_tee_jays_angelos/homepage/__pycache__/
widget_tee_jays_angelos/homepage/migrations/__pycache__/
widget_tee_jays_angelos/announcements/__pycache__/
widget_tee_jays_angelos/announcements/migrations/__pycache__/
widget_tee_jays_angelos/forum/__pycache__/
widget_tee_jays_angelos/forum/migrations/__pycache__/
widget_tee_jays_angelos/assignments/__pycache__/
widget_tee_jays_angelos/assignments/migrations/__pycache__/
*/__pycache__/*
\ No newline at end of file
h1 {
color: blue;
font-weight: bold;
}
ul li {
text-decoration: underline;
}
li {
padding-bottom: 20px;
}
.bold{
font-weight: bold;
color: red;
font-size: 20px;
}
.small{
font-weight: normal
color: black;
font-size: 17px;
}
{% extends 'base.html' %}
{% block head %}
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'assignments/style.css' %}">
{% endblock %}
{% block content %}
<h1> {{course}} {{course.course_title}}</h1>
<li class = "bold"> Name: {{assignment.name}} </li>
<li> Description: {{assignment.description}} </li>
<li> Perfect Score: {{assignment.max_points}} </li>
<li> Passing Score: {{assignment.passing_score}} </li>
<img src= "/static/assignments/{{assignment.name}}.jpg">
{% endblock %}
{% extends 'base.html' %}
{% block head %}
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'assignments/style.css' %}">
{% endblock %}
{% block content %}
<h1> Assignments Per Course </h1>
{% if course_list %}
{% for course in course_list %}
<li class = "bold"> {{course}} {{course.course_title}} {{course.section}}
{% for assignment in assignment_list %}
{% if assignment.course_code == course %}
<ul class = "small">
<li> <a href="/assignments/{{assignment.name}}/">{{assignment.name}}</a></li>
</ul>
{% endif %}
{% endfor %}
</li>
{% endfor %}
{% else %}
<p>No assignments are available </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="assignments") path('', views.index, name="assignments"),
path("<str:name>/", views.detail, name = "details"),
] ]
from django.http import HttpResponse from django.http import HttpResponse, Http404
from assignments.models import Assignment, Course from assignments.models import Assignment, Course
from django.shortcuts import render
from django.template import loader
# Create your views here. # Create your views here.
def index(request): def index(request):
assignmentOutput = "Assignments: <br/><br/>" course_list = Course.objects.order_by("course_code")
for n in Assignment.objects.all(): assignment_list = Assignment.objects.all()
assignmentOutput += ("Assignment Name: " + str(n.name) + "<br/>") template = loader.get_template("assignments/index.html")
assignmentOutput += ("Description: " + n.description + "<br/>") context = {
assignmentOutput += ("Perfect Score: " + str(n.max_points) + "<br/>") "course_list": course_list,
assignmentOutput += ("Passing Score: " + str(n.passing_score) + "<br/>") "assignment_list": assignment_list
assignmentOutput += ("Course/Section: " + Course.objects.get(course_code = n.course_code).course_code + " ") }
assignmentOutput += (Course.objects.get(course_code = n.course_code).course_title + " ") return HttpResponse(template.render(context, request))
assignmentOutput += (Course.objects.get(course_code = n.course_code).section + "<br/><br/>")
return HttpResponse(assignmentOutput) def detail(request, name):
try:
assignment = Assignment.objects.get(name = name)
course = Course.objects.get(course_code = assignment.course_code)
except Assignment.DoesNotExist:
raise Http404("Assignment does not exist!")
template = loader.get_template("assignments/detail.html")
context = {
"assignment": assignment,
"course": course
}
return HttpResponse (template.render(context, request))
# Generated by Django 4.0.3 on 2022-04-05 13:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_widgetuser_email_widgetuser_id_num_department'),
]
operations = [
migrations.AlterField(
model_name='department',
name='dept_name',
field=models.CharField(max_length=50, null=True),
),
migrations.AlterField(
model_name='department',
name='home_unit',
field=models.CharField(max_length=50, null=True),
),
migrations.AlterField(
model_name='widgetuser',
name='first_name',
field=models.CharField(max_length=50, null=True),
),
migrations.AlterField(
model_name='widgetuser',
name='last_name',
field=models.CharField(max_length=50, null=True),
),
migrations.AlterField(
model_name='widgetuser',
name='middle_name',
field=models.CharField(max_length=50, null=True),
),
]
# Generated by Django 4.0.3 on 2022-05-08 04:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_alter_department_dept_name_and_more'),
]
operations = [
migrations.RemoveField(
model_name='widgetuser',
name='email',
),
]
# Generated by Django 4.0.3 on 2022-05-08 05:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0004_remove_widgetuser_email'),
]
operations = [
migrations.AddField(
model_name='widgetuser',
name='email',
field=models.CharField(max_length=50, null=True),
),
]
# Generated by Django 4.0.3 on 2022-05-08 08:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0005_widgetuser_email'),
]
operations = [
migrations.AddField(
model_name='widgetuser',
name='picture',
field=models.ImageField(null=True, upload_to=None),
),
]
# Generated by Django 4.0.3 on 2022-05-08 08:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0006_widgetuser_picture'),
]
operations = [
migrations.AlterField(
model_name='widgetuser',
name='picture',
field=models.ImageField(null=True, upload_to='media'),
),
]
# Generated by Django 4.0.3 on 2022-05-10 06:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0007_alter_widgetuser_picture'),
]
operations = [
migrations.AlterField(
model_name='widgetuser',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='media'),
),
]
# Generated by Django 4.0.3 on 2022-05-10 07:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0008_alter_widgetuser_picture'),
]
operations = [
migrations.AlterField(
model_name='widgetuser',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='static/media/'),
),
]
# Generated by Django 4.0.3 on 2022-05-10 07:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0009_alter_widgetuser_picture'),
]
operations = [
migrations.AlterField(
model_name='widgetuser',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='homepage/static/media/'),
),
]
# Generated by Django 4.0.3 on 2022-05-10 14:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0010_alter_widgetuser_picture'),
]
operations = [
migrations.AlterField(
model_name='widgetuser',
name='picture',
field=models.ImageField(blank=True, null=True, upload_to='media/'),
),
]
...@@ -3,11 +3,12 @@ from django.db import models ...@@ -3,11 +3,12 @@ from django.db import models
class WidgetUser(models.Model): class WidgetUser(models.Model):
first_name = models.CharField(max_length=50) first_name = models.CharField(max_length=50, null=True)
middle_name = models.CharField(max_length=50) middle_name = models.CharField(max_length=50, null=True)
last_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50, null=True)
id_num = models.CharField(max_length=7, null=True) id_num = models.CharField(max_length=7, null=True)
email = models.CharField(max_length=50, null=True) email = models.CharField(max_length=50, null=True)
picture = models.ImageField(upload_to="media/", height_field=None, width_field=None, max_length=100, null=True, blank=True)
def __str__(self): def __str__(self):
return self.last_name + ", " + self.first_name return self.last_name + ", " + self.first_name
...@@ -16,8 +17,8 @@ class WidgetUser(models.Model): ...@@ -16,8 +17,8 @@ class WidgetUser(models.Model):
class Department(models.Model): class Department(models.Model):
widget_user = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, widget_user = models.ForeignKey(WidgetUser, on_delete=models.CASCADE,
blank=True, null=True) blank=True, null=True)
dept_name = models.CharField(max_length=50) dept_name = models.CharField(max_length=50, null=True)
home_unit = models.CharField(max_length=50) home_unit = models.CharField(max_length=50, null=True)
def __str__(self): def __str__(self):
return self.dept_name + ", " + self.home_unit return self.dept_name + ", " + self.home_unit
h1, h2 {
color: black;
font-family: 'Montserrat', sans-serif;
position: relative;
}
li {
color: black;
font-family: 'Source Sans Pro', sans-serif;
position: relative;
top: 10px;
margin: 10px;
}
p {
font-family: 'Source Sans Pro', sans-serif;
font-size: 18px;
}
img {
position: absolute;
left: 400px;
top: 20px;
border-radius: 50%;
}
.picShadow {
height: 200px;
width: 200px;
border-radius: 50%;
background-color: grey;
position: absolute;
left: 390px;
top: 30px;
}
.detailsHeaderName {
color: black;
position: absolute;
left: 650px;
top: 70px;
}
.detailsHeaderDept {
font-family: 'Source Sans Pro', sans-serif;
color: black;
font-style: italic;
position: absolute;
left: 650px;
top: 120px;
font-weight: lighter;
}
.rectangleDetailsHeader {
position: absolute;
left: 0px;
top: 0px;
height: 250px;
width: 100%;
background-color: #daeaf6;
}
.homepageRectangleHeader {
position: absolute;
left: 0px;
top: 0px;
width: 100%;
height: 80px;
background-color: #ddedea;
}
.arrow {
width: 20px;
height: 4px;
background-color: black;
position: relative;
top: 10px;
left: 5px;
}
.arrow:before {
content: "";
display: inline-block;
position: relative;
top: -17px;
left: 0px;
width:15px;
height: 4px;
background-color: black;
transform: rotate(-45deg);
}
.arrow:after {
content: "";
display: inline-block;
position: relative;
top: -23px;
left: -1px;
width:15px;
height: 4px;
background-color: black;
transform: rotate(45deg);
}
{% load static %}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<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="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="{% static 'homepage/homepagestyle.css' %}">
<title>Homepage</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
{% extends "homepage/base.html "%}
{% block content %}
{% if user %}
<div class="rectangleDetailsHeader"></div>
<a href="/homepage/"><div class="arrow"></div></a>
<h1 class="detailsHeaderName">{{ user.first_name }} {{ user.last_name }}</h1>
<h3 class="detailsHeaderDept">Department of {{ userDept.dept_name }}</h3>
<h2 style="position: absolute; left: 300px; top: 270px; background-color: #fcf4dd;">Personal Information</h2>
<h2 style="position: absolute; left: 300px; top: 450px; background-color: #fcf4dd;">Department Information</h2>
<h2 style="position: absolute; left: 850px; top: 270px; background-color: #fcf4dd;">Contact Details</h2>
<p style="position:absolute; left: 300px; top: 325px;">Complete Name: {{ user.last_name }}, {{user.first_name }} {{ user.middle_name }}</p>
<p style="position:absolute; left: 300px; top: 370px;">ID Number: {{ user.id_num }}</p>
<p style="position: absolute; left: 300px; top: 500px;">Department: {{ userDept.dept_name }}</p>
<p style="position: absolute; left: 300px; top: 545px;">Home Unit: {{ userDept.home_unit }}</p>
<p style="position: absolute; left: 850px; top: 325px;">Email: {{ user.email }}</p>
<div class="picShadow"></div>
<img src="{{ user.picture.url }}" width="200" height="200">
{% else %}
<p>User not found.</p>
{% endif %}
{% endblock %}
{% extends "homepage/base.html" %}
{% block content %}
<div class="homepageRectangleHeader"></div>
<h1 style="text-align: center">Welcome to Widget!</h1>
<h2 style="position: relative; top: 20px;">Widget Users</h2>
{% if user_list %}
<ol type="1">
{% for user in user_list %}
<li><a href="/homepage/users/{{ user.id }}/details">{{ user.last_name }}, {{ user.first_name }} {{ user.middle_name }}</a></li>
{% endfor %}
</ol>
{% else %}
<p>No users found.</p>
{% endif %}
{% endblock %}
from django.urls import path from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name="homepage") path('', views.index, name="homepage"),
path('users/<int:user_id>/details/', views.details, name="details"),
] ]
from django.http import HttpResponse from django.http import HttpResponse, Http404
from homepage.models import WidgetUser, Department from homepage.models import WidgetUser, Department
from django.shortcuts import render
from django.template import loader
# Create your views here. # Create your views here.
def index(request): def index(request):
entries = WidgetUser.objects.all().count() user_list = WidgetUser.objects.order_by("last_name")
n = 1 context = {
users = "WIDGET USERS:<br/>" "user_list": user_list,
while (n <= entries): }
userLastName = WidgetUser.objects.get(pk=n).last_name
userFirstName = WidgetUser.objects.get(pk=n).first_name
userMiddleName = WidgetUser.objects.get(pk=n).middle_name
userIdNum = WidgetUser.objects.get(pk=n).id_num
userEmail = WidgetUser.objects.get(pk=n).email
userDept = Department.objects.get(widget_user=n).dept_name
userHome = Department.objects.get(widget_user=n).home_unit
users = users + userLastName + ", " + userFirstName + " " + userMiddleName + ": " + userIdNum + ", " + userEmail + ", " + userDept + ", " + userHome + "<br/>"
n += 1
return HttpResponse(users) return render(request, "homepage/index.html", context)
def details(request, user_id):
try:
user = WidgetUser.objects.get(pk=user_id)
userDept = Department.objects.get(widget_user=user)
except WidgetUser.DoesNotExist:
raise Http404("User does not exist.")
context = {
"user": user,
"userDept": userDept,
}
return render(request, "homepage/details.html", context)
{% 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, inital-scale=1.0">
{% block head %}
{% endblock %}
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
...@@ -62,7 +62,7 @@ ROOT_URLCONF = 'widget_tee_jays_angelos.urls' ...@@ -62,7 +62,7 @@ ROOT_URLCONF = 'widget_tee_jays_angelos.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [], 'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
...@@ -123,7 +123,11 @@ USE_TZ = True ...@@ -123,7 +123,11 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/ # https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL = 'static/' STATIC_URL = '/static/'
MEDIA_URL = '/images/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static/images')
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
......
...@@ -15,6 +15,8 @@ Including another URLconf ...@@ -15,6 +15,8 @@ Including another URLconf
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
path('forum/', include("forum.urls")), path('forum/', include("forum.urls")),
...@@ -22,5 +24,6 @@ urlpatterns = [ ...@@ -22,5 +24,6 @@ urlpatterns = [
path('homepage/', include("homepage.urls")), path('homepage/', include("homepage.urls")),
path('announcements/', include("announcements.urls")), path('announcements/', include("announcements.urls")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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