Commit 66ee34c0 authored by Christopher Jorge Chan's avatar Christopher Jorge Chan

updating master from homepage

parents 5cc7bdd3 8b595c15
body{
font-family: Arial;
background-color: orange;
color: green;
}
\ No newline at end of file
#profilepic{
width: 20%;
height: 20%;
border-radius: 40px;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
{%load static%}
<head>
<title>Widget</title>
<link rel="stylesheet" type="text/css" href="{%static 'homepage/css/base.css'%}">
</head>
<body>
{%block body%}
{%endblock%}
</body>
</html>
\ No newline at end of file
{%extends "homepage/base.html" %}
{%load static%}
{%block body%}
<link rel="stylesheet" type="text/css" href="{%static 'homepage/css/details.css'%}">
<div class="container main">
<img id="profilepic" src="{%static imgurl%}"> <br><br>
<h1>{{widget_user.last_name}}, {{widget_user.first_name}} {{widget_user.middle_name}}</h1>
<h2>{{widget_user.id_num}}</h2>
<h3>{{widget_user.email}}</h3>
<h4>{{widget_user.department.dept_name}}</h4>
<h4>{{widget_user.department.home_unit}}</h4>
</div>
{%endblock%}
\ No newline at end of file
{%extends "homepage/base.html" %}
{%load static%}
{%block body%}
<link rel="stylesheet" type="text/css" href="{%static 'homepage/css/home.css'%}">
<div class="container main">
<h1>Welcome to Widget!</h1><br>
<h2>Widget Users:</h2>
<ol class="widgetusers">
{%for w in widget_users%}
<li><a href="{%url 'details' w.id_num%}">{{w.last_name}}, {{w.first_name}} {{w.middle_name}}</a></li>
{%endfor%}
</ol>
</div>
{%endblock%}
\ No newline at end of file
...@@ -2,5 +2,6 @@ from django.urls import path ...@@ -2,5 +2,6 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name='index') path('', views.homepage_view, name='homepage'),
path('users/<user_id>/details', views.details, name='details')
] ]
\ No newline at end of file
...@@ -3,6 +3,7 @@ from django.http import HttpResponse ...@@ -3,6 +3,7 @@ from django.http import HttpResponse
from .models import Department, WidgetUser from .models import Department, WidgetUser
# Create your views here. # Create your views here.
"""
def index(request): def index(request):
message = 'WIDGET USERS:<br/>' message = 'WIDGET USERS:<br/>'
...@@ -13,4 +14,22 @@ def index(request): ...@@ -13,4 +14,22 @@ def index(request):
for w in widget_users: for w in widget_users:
message += f"{w.last_name}, {w.first_name} {w.middle_name}: {w.id_num}, {w.email}, {d.dept_name}, {d.home_unit}<br/>" message += f"{w.last_name}, {w.first_name} {w.middle_name}: {w.id_num}, {w.email}, {d.dept_name}, {d.home_unit}<br/>"
return HttpResponse(message) return HttpResponse(message)
\ No newline at end of file """
def homepage_view(request):
widget_users = WidgetUser.objects.all().order_by('last_name')
homepage_dict = {
"widget_users" : widget_users
}
return render(request, "homepage/home.html", homepage_dict)
def details(request, user_id):
widget_user = WidgetUser.objects.get(id_num=user_id)
imgurl = f"homepage/images/{user_id}.png"
details_dict = {
"widget_user" : widget_user,
"imgurl" : imgurl
}
return render(request, "homepage/details.html", details_dict)
\ No newline at end of file
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