Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Francoconuts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Chester Tan
widget_Francoconuts
Commits
3694283e
Commit
3694283e
authored
May 21, 2022
by
AllenSkyy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ListVies and Detail Vies for Homepage
parent
7ffd573d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
14 deletions
+38
-14
homepage.html
widget_Francoconuts/homepage/templates/homepage.html
+0
-4
widgetuser_detail.html
...conuts/homepage/templates/homepage/widgetuser_detail.html
+11
-0
widgetuser_list.html
...coconuts/homepage/templates/homepage/widgetuser_list.html
+14
-0
urls.py
widget_Francoconuts/homepage/urls.py
+4
-4
views.py
widget_Francoconuts/homepage/views.py
+9
-6
pepe.png
widget_Francoconuts/static/homepage/pepe.png
+0
-0
No files found.
widget_Francoconuts/homepage/templates/homepage.html
deleted
100644 → 0
View file @
7ffd573d
<h1>
WIDGET USERS:
</h1>
{% for data in homepage %}
{{data.last_name}}, {{data.first_name}} {{data.middle_name}}: {{data.id_num}}, {{data.email}}, {{data.department.dept_name}}, {{data.department.home_unit}}
<br>
{% endfor %}
widget_Francoconuts/homepage/templates/homepage/widgetuser_detail.html
0 → 100644
View file @
3694283e
{% block content %}
<ul>
<li>
Complete Name: {{widgetuser.last_name}}, {{widgetuser.first_name}} {{widgetuser.middle_name}}
</li>
<li>
{{widgetuser.id_num}}
</li>
<li>
{{widgetuser.email}}
</li>
<li>
{{widgetuser.department.dept_name}}
</li>
<li>
{{widgetuser.department.home_unit}}
</li>
{% load static %}
<li><img
src=
"{% static 'homepage/pepe.png' %}"
alt=
"image"
></li>
</ul>
{% endblock content %}
widget_Francoconuts/homepage/templates/homepage/widgetuser_list.html
0 → 100644
View file @
3694283e
{% extends 'base.html' %}
{% block content%}
<h1>
Welcome to Widget!
</h1>
<ul>
Widget Users:
<br>
{% for widgetuser in object_list|dictsort:"last_name" %}
<body>
<a
href=
"{% url 'homepage:widgetuser-detail' id_num=widgetuser.id_num %}"
>
{{forloop.counter}}. {{widgetuser.last_name}}, {{widgetuser.first_name}} {{widgetuser.middle_name}}
<br>
</a>
</body>
{% endfor %}
</ul>
{% endblock content%}
widget_Francoconuts/homepage/urls.py
View file @
3694283e
from
django.urls
import
path
from
.views
import
homepage
from
.views
import
WidgetUserListView
,
WidgetUserDetailView
urlpatterns
=
[
path
(
''
,
homepage
,
name
=
'homepage'
),
path
(
''
,
WidgetUserListView
.
as_view
(),
name
=
'widgetuser-list'
),
path
(
'users/<str:id_num>/details/'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser-detail'
)
]
app_name
=
'homepage'
\ No newline at end of file
app_name
=
'homepage'
widget_Francoconuts/homepage/views.py
View file @
3694283e
from
django.shortcuts
import
render
from
.models
import
Department
,
WidgetUser
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
class
WidgetUserListView
(
ListView
):
model
=
WidgetUser
def
homepage
(
request
):
homepage_context
=
WidgetUser
.
objects
.
all
()
context
=
{
'homepage'
:
homepage_context
}
return
render
(
request
,
'homepage.html'
,
context
)
class
WidgetUserDetailView
(
DetailView
):
model
=
WidgetUser
def
get_object
(
self
,
queryset
=
None
):
return
WidgetUser
.
objects
.
get
(
id_num
=
self
.
kwargs
.
get
(
"id_num"
))
widget_Francoconuts/static/homepage/pepe.png
0 → 100644
View file @
3694283e
152 KB
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