Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Angelico Ruiz T. Teaño
widget_Alipins
Commits
e54bcb5d
Commit
e54bcb5d
authored
May 16, 2022
by
Irish Danielle Morales
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update homepage and subpages
parent
a29cbfc6
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
141 additions
and
18 deletions
+141
-18
db.sqlite3
widget_alipins/db.sqlite3
+0
-0
admin.py
widget_alipins/homepage/admin.py
+2
-2
0006_widgetuser_image.py
widget_alipins/homepage/migrations/0006_widgetuser_image.py
+18
-0
models.py
widget_alipins/homepage/models.py
+1
-0
detail.html
widget_alipins/homepage/templates/homepage/detail.html
+22
-0
index.html
widget_alipins/homepage/templates/homepage/index.html
+23
-0
urls.py
widget_alipins/homepage/urls.py
+3
-2
views.py
widget_alipins/homepage/views.py
+14
-14
Costeau_Raphael_Ambrosius.jpg
widget_alipins/media/homepage/Costeau_Raphael_Ambrosius.jpg
+0
-0
Espinosa_Gaemon_Carasco.jpg
widget_alipins/media/homepage/Espinosa_Gaemon_Carasco.jpg
+0
-0
Gentolia_Emilio_Antonio_Sagon.jpg
..._alipins/media/homepage/Gentolia_Emilio_Antonio_Sagon.jpg
+0
-0
style.css
widget_alipins/static/homepage/style.css
+58
-0
No files found.
widget_alipins/db.sqlite3
View file @
e54bcb5d
No preview for this file type
widget_alipins/homepage/admin.py
View file @
e54bcb5d
...
...
@@ -9,8 +9,8 @@ class DepartmentAdmin(admin.ModelAdmin):
class
WidgetUserAdmin
(
admin
.
ModelAdmin
):
model
=
WidgetUser
search_fields
=
[
'first_name'
,
'middle_name'
,
'last_name'
,
'id_num'
,
'email'
,
'department'
]
list_display
=
(
'first_name'
,
'middle_name'
,
'last_name'
,
'id_num'
,
'email'
,
'department'
)
search_fields
=
[
'first_name'
,
'middle_name'
,
'last_name'
,
'id_num'
,
'email'
,
'department'
,
'image'
]
list_display
=
(
'first_name'
,
'middle_name'
,
'last_name'
,
'id_num'
,
'email'
,
'department'
,
'image'
)
admin
.
site
.
register
(
Department
,
DepartmentAdmin
)
admin
.
site
.
register
(
WidgetUser
,
WidgetUserAdmin
)
\ No newline at end of file
widget_alipins/homepage/migrations/0006_widgetuser_image.py
0 → 100644
View file @
e54bcb5d
# Generated by Django 4.0.3 on 2022-05-16 19:24
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0005_alter_widgetuser_id_num'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'widgetuser'
,
name
=
'image'
,
field
=
models
.
ImageField
(
blank
=
True
,
null
=
True
,
upload_to
=
'homepage/'
),
),
]
widget_alipins/homepage/models.py
View file @
e54bcb5d
...
...
@@ -18,6 +18,7 @@ class WidgetUser(models.Model):
id_num
=
models
.
CharField
(
max_length
=
7
,
validators
=
[
RegexValidator
(
r'^\d+$'
)])
email
=
models
.
EmailField
(
max_length
=
200
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
image
=
models
.
ImageField
(
null
=
True
,
blank
=
True
,
upload_to
=
"homepage/"
)
def
__str__
(
self
):
full_name
=
self
.
first_name
+
" "
+
self
.
middle_name
+
" "
+
self
.
last_name
...
...
widget_alipins/homepage/templates/homepage/detail.html
0 → 100644
View file @
e54bcb5d
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'homepage/style.css' %}"
>
{% endblock %}
{% block title %}{{user.user_id}}{% endblock %}
{% block content %}
<h1>
{{user.last_name}}, {{user.first_name}} {{user.middle_name}}
</h1>
<div>
{% if user.image %}
<p
style=
"text-align:center"
><img
src =
"{{ user.image.url }}"
></p><br>
{% endif %}
<ul>
<li>
ID Number: {{user.id_num}}
</li>
<li>
Email Address: {{user.email}}
</li>
<li>
Department: {{user.department.dept_name}}
</li>
<li>
Home Unit: {{user.department.home_unit}}
</li>
</ul>
</div>
{% endblock %}
\ No newline at end of file
widget_alipins/homepage/templates/homepage/index.html
0 → 100644
View file @
e54bcb5d
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'homepage/style.css' %}"
>
{% endblock %}
{% block title %}Homepage{% endblock %}
{% block content %}
<h1>
Welcome to Widget!
</h1>
<div>
<h2>
Widget Users:
</h3>
{% if user_list %}
<ol>
{% for user in user_list %}
<li><a
href=
"{% url 'homepage:details' user.id%}"
>
{{user.last_name}}, {{user.first_name}} {{user.middle_name}}
</a></li>
{% endfor %}
</ol>
{% else %}
<p>
There are no existing users.
</p>
{% endif %}
</div>
{% endblock %}
\ No newline at end of file
widget_alipins/homepage/urls.py
View file @
e54bcb5d
from
django.urls
import
path
from
.
import
views
app_name
=
"homepage"
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"indexHomepage"
)
path
(
''
,
views
.
index
,
name
=
"indexHomepage"
),
path
(
'<int:user_id>/details'
,
views
.
details
,
name
=
"details"
)
]
\ No newline at end of file
widget_alipins/homepage/views.py
View file @
e54bcb5d
from
django.http
import
Http
Response
from
django.http
import
Http
404
from
django.shortcuts
import
render
from
.models
import
WidgetUser
def
index
(
request
):
display_output
=
"<u><b>WIDGET USERS</u></b>: <br>"
user_list
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
context
=
{
"user_list"
:
user_list
}
return
render
(
request
,
"homepage/index.html"
,
context
)
for
objects
in
WidgetUser
.
objects
.
all
():
display_output
+=
'''
<b>{last_name}, {first_name} {middle_name}</b>: {id}, {email}, {dept}, {home}<br>
'''
.
format
(
last_name
=
objects
.
last_name
,
first_name
=
objects
.
first_name
,
middle_name
=
objects
.
middle_name
,
id
=
objects
.
id_num
,
email
=
objects
.
email
,
dept
=
objects
.
department
.
dept_name
,
home
=
objects
.
department
.
home_unit
)
def
details
(
request
,
user_id
):
try
:
user
=
WidgetUser
.
objects
.
get
(
pk
=
user_id
)
except
WidgetUser
.
DoesNotExist
:
raise
Http404
(
"User does not exist!"
)
return
HttpResponse
(
display_output
)
return
render
(
request
,
"homepage/detail.html"
,
{
"user"
:
user
}
)
\ No newline at end of file
widget_alipins/media/homepage/Costeau_Raphael_Ambrosius.jpg
0 → 100644
View file @
e54bcb5d
150 KB
widget_alipins/media/homepage/Espinosa_Gaemon_Carasco.jpg
0 → 100644
View file @
e54bcb5d
75.6 KB
widget_alipins/media/homepage/Gentolia_Emilio_Antonio_Sagon.jpg
0 → 100644
View file @
e54bcb5d
129 KB
widget_alipins/static/homepage/style.css
0 → 100644
View file @
e54bcb5d
body
{
font-family
:
sans-serif
,
Arial
,
Helvetica
;
color
:
#035700
;
line-height
:
2
;
}
div
{
margin
:
auto
;
width
:
50%
;
border
:
3px
solid
rgb
(
194
,
7
,
169
);
padding
:
30px
40px
40px
40px
;
}
h1
{
font-size
:
40px
;
text-align
:
center
;
text-decoration
:
underline
;
}
h2
{
font-size
:
28px
;
margin
:
0px
0px
10px
0px
;
text-align
:
center
;
}
ul
{
list-style-type
:
none
;
}
li
{
font-size
:
20px
;
}
p
{
font-size
:
20px
;
}
span
{
font-weight
:
bold
;
}
span
.perfect
{
color
:
rgb
(
96
,
189
,
96
);
}
span
.passing
{
color
:
#bb5959
}
img
{
border-radius
:
50%
;
max-width
:
100%
;
height
:
auto
;
}
a
{
color
:
#891fa3
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment