Commit 6945a987 authored by Andre Matthew Dumandan's avatar Andre Matthew Dumandan 😴

Merge branch 'dumandan/homepage'

parents b6fdb185 896379f3
...@@ -12,7 +12,7 @@ class Department(models.Model): ...@@ -12,7 +12,7 @@ class Department(models.Model):
def get_dept_info(self): def get_dept_info(self):
return '{}, {}'.format(self.dept_name, self.home_unit) return '{}, {}'.format(self.dept_name, self.home_unit)
class WidgetUser(models.Model): class WidgetUser(models.Model):
def ID_validator(value): def ID_validator(value):
if value.isdigit() != True: if value.isdigit() != True:
......
from django.urls import path from django.urls import path
from homepage import views
from .views import index
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', views.index, name='index'),
path('users/<str:user_id>/details', views.details, name='details'),
] ]
app_name = "homepage" app_name = "homepage"
\ No newline at end of file
from re import A, template
from django.shortcuts import render from django.shortcuts import render
from django.template import loader
from django.http import HttpResponse from django.http import HttpResponse
from .models import WidgetUser from .models import WidgetUser
# Create your views here. # Create your views here.
def index(request): def index(request):
model = WidgetUser user_list = WidgetUser.objects.order_by("last_name")
widget_users = model.objects.all() template = loader.get_template("homepage/homepage.html")
homepage_response = "WIDGET USERS: </br>" context = {
"user_list" : user_list,
}
return HttpResponse(template.render(context,request))
for user in widget_users:
homepage_response += user.get_user_info()
return HttpResponse(homepage_response) def details(request,user_id):
\ No newline at end of file user = WidgetUser.objects.get(id_num=user_id)
template = loader.get_template("homepage/details.html")
context = {
"user" : user,
}
return HttpResponse(template.render(context,request))
#model = WidgetUser
#widget_users = model.objects.all()
#homepage_response = "WIDGET USERS: </br>"
#for user in widget_users:
#homepage_response += user.get_user_info()
#return HttpResponse(homepage_response)
\ No newline at end of file
@import url('https://fonts.googleapis.com/css?family=Klavika&display=swap');
body {
background-color: rgb(227,229,231);
font-family: Helvetica, Arial, sans-serif;
}
header{
padding: 70px;
background-color:rgb(35,116,225);
margin: -9px;
margin-bottom: 0px;
}
wid {
float: left;
margin-top: 50px;
margin-left: 10px;
color: white;
font-family: Klavika, Helvetica, Arial, sans-serif;
font-size: 25px;
font-weight: bold;
}
infohead{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 10px;
color: black;
font-size: 20px;
line-height: 40px;
font-weight: bold;
}
info{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 10px;
color: black;
font-size: large;
line-height: 40px;
}
img {
border: 5px solid rgb(227,229,231);
border-radius: 50%;
float: right;
margin-top: -100px;
margin-right: 50px;
}
@import url('https://fonts.googleapis.com/css?family=Klavika&display=swap');
body {
background-color: rgb(227,229,231);
}
header {
margin-top: -10px;
margin-left: -10px;
margin-right: -10px;
padding: 30px;
background-color: rgb(35,116,225);
text-align: center;
color: white;
font-size: 200%;
font-family: Klavika, Arial, Helvetica, sans-serif;
font-weight: bold;
}
p {
color: black;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, Arial, sans-serif;
text-align: center;
}
wu {
font-size: 25px;
font-weight: 500;
}
a {
color: black;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
text-decoration: none;
font-size: large;
}
{% extends 'base.html' %}
{% load static %}
{% block title %} User Details {% endblock %}
{% block styles %} <link rel="stylesheet" href="{% static 'homepage/css/details.css' %}"> {% endblock %}
{% block content %}
<wid>{{user.last_name}}, {{user.first_name}} {{user.middle_name}}</wid>
<header></header>
<img src="{% static 'homepage/img/profile-picture.jpg' %}" alt="Profile Picture">
<infohead>User Details</br></infohead>
<info>
ID number: {{user.id_num}} </br>
Email address: {{user.email}} </br>
Department name: {{user.department}} </br>
Home unit: {{user.department.home_unit}} </br>
</info>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %} Homepage {% endblock %}
{% block styles %} <link rel="stylesheet" href="{% static 'homepage/css/homepage.css' %}"> {% endblock %}
{% block content %}
<header> Welcome to the Widget! </header>
<p>
<wu> Widget Users: </wu>
<ol type = '1'>
{% for user in user_list %}
<a href = "{% url 'homepage:details' user.id_num %}"">
<li>{{user.last_name}}, {{user.first_name}} {{user.middle_name}} </br> </a> </li> </p>
{% endfor %}
</ol>
{% endblock %}
\ 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