Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_someone here is possessed by an owl
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
Laetitia de Castro
widget_someone here is possessed by an owl
Commits
af784cd4
Commit
af784cd4
authored
May 24, 2022
by
Anya Habana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created template for users details' pages
parent
e3b473e4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
5 deletions
+33
-5
views.cpython-38.pyc
homepage/__pycache__/views.cpython-38.pyc
+0
-0
index.html
homepage/templates/users/index.html
+1
-1
users.html
homepage/templates/users/users.html
+24
-0
views.py
homepage/views.py
+8
-4
No files found.
homepage/__pycache__/views.cpython-38.pyc
View file @
af784cd4
No preview for this file type
homepage/templates/users/index.html
View file @
af784cd4
...
...
@@ -13,7 +13,7 @@
{% if user_list %}
<ol>
{% for user in user_list %}
<li><a
href=
"/users/{{ user.id }}/details/"
>
</a>
{{ user.last_name }}, {{ user.first_name }} {{ user.middle_name }}
</li>
<li><a
href=
"/users/{{ user.id }}/details/"
>
{{ user.last_name }}, {{ user.first_name }} {{ user.middle_name }}
</a>
</li>
{% endfor %}
</ol>
{% else %}
...
...
homepage/templates/users/users.html
0 → 100644
View file @
af784cd4
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget Users{% endblock %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/styles.css' %}"
>
{% endblock %}
{% block content %}
{% if user_list %}
{% for user in user_list %}
<h1
class=
"homepage-heading"
>
{{ user.last_name }}, {{ user.first_name }} {{ user.middle_name }}
</h1>
<ul>
<p>
{{ user.id }}
</p>
<p>
{{ user.email }}
</p>
<p>
{{ user.department.dept_name }}
</p>
<p>
{{ user.department.home_unit }}
</p>
</ul>
{% endfor %}
{% else %}
<p>
There are no widget users currently.
</p>
{% endif %}
{% endblock %}
homepage/views.py
View file @
af784cd4
...
...
@@ -3,11 +3,15 @@ from django.http import HttpResponse
from
django.template
import
loader
from
.models
import
WidgetUser
def
index
(
request
):
user_list
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
template
=
loader
.
get_template
(
"users/index.html"
)
context
=
{
user_list
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
context
=
{
"user_list"
:
user_list
,
}
def
index
(
request
):
template
=
loader
.
get_template
(
"users/index.html"
)
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
details
(
request
):
template
=
loader
.
get_template
(
"users/users.html"
)
return
HttpResponse
(
template
.
render
(
context
,
request
))
\ 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