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
20f64a0e
Commit
20f64a0e
authored
May 24, 2022
by
Anya Habana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified and rendered the users' details' template
parent
af784cd4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
22 deletions
+18
-22
urls.cpython-38.pyc
homepage/__pycache__/urls.cpython-38.pyc
+0
-0
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
+8
-13
urls.py
homepage/urls.py
+2
-1
views.py
homepage/views.py
+7
-7
No files found.
homepage/__pycache__/urls.cpython-38.pyc
View file @
20f64a0e
No preview for this file type
homepage/__pycache__/views.cpython-38.pyc
View file @
20f64a0e
No preview for this file type
homepage/templates/users/index.html
View file @
20f64a0e
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
{% if user_list %}
{% if user_list %}
<ol>
<ol>
{% for user in user_list %}
{% for user in user_list %}
<li><a
href=
"/users/{{ user.id }}/details/"
>
{{ user.last_name }}, {{ user.first_name }} {{ user.middle_name }}
</a></li>
<li><a
href=
"/
homepage/
users/{{ user.id }}/details/"
>
{{ user.last_name }}, {{ user.first_name }} {{ user.middle_name }}
</a></li>
{% endfor %}
{% endfor %}
</ol>
</ol>
{% else %}
{% else %}
...
...
homepage/templates/users/users.html
View file @
20f64a0e
...
@@ -8,17 +8,12 @@
...
@@ -8,17 +8,12 @@
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
{% if user_list %}
<h1
class=
"homepage-heading"
>
Widget User Details
</h1>
{% for user in user_list %}
<h2
class=
"homepage-subheading"
>
{{ widgetuser.last_name }}, {{ widgetuser.first_name }} {{ widgetuser.middle_name }}
</h2>
<h1
class=
"homepage-heading"
>
{{ user.last_name }}, {{ user.first_name }} {{ user.middle_name }}
</h1>
<ul>
<ul>
<p>
ID: {{ widgetuser.id }}
</p>
<p>
{{ user.id }}
</p>
<p>
Email: {{ widgetuser.email }}
</p>
<p>
{{ user.email }}
</p>
<p>
Department Name: {{ widgetuser.department.dept_name }}
</p>
<p>
{{ user.department.dept_name }}
</p>
<p>
Home Unit: {{ widgetuser.department.home_unit }}
</p>
<p>
{{ user.department.home_unit }}
</p>
</ul>
</ul>
{% endfor %}
{% else %}
<p>
There are no widget users currently.
</p>
{% endif %}
{% endblock %}
{% endblock %}
homepage/urls.py
View file @
20f64a0e
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
WidgetUserDetailView
,
index
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
index
,
name
=
'index'
),
path
(
'users/<int:pk>/details/'
,
WidgetUserDetailView
.
as_view
(),
name
=
'details'
),
]
]
app_name
=
'homepage'
app_name
=
'homepage'
\ No newline at end of file
homepage/views.py
View file @
20f64a0e
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.template
import
loader
from
django.template
import
loader
from
django.views.generic.detail
import
DetailView
from
.models
import
WidgetUser
from
.models
import
WidgetUser
user_list
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
def
index
(
request
):
context
=
{
user_list
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
context
=
{
"user_list"
:
user_list
,
"user_list"
:
user_list
,
}
}
def
index
(
request
):
template
=
loader
.
get_template
(
"users/index.html"
)
template
=
loader
.
get_template
(
"users/index.html"
)
return
HttpResponse
(
template
.
render
(
context
,
request
))
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
details
(
request
):
class
WidgetUserDetailView
(
DetailView
):
template
=
loader
.
get_template
(
"users/users.html"
)
model
=
WidgetUser
return
HttpResponse
(
template
.
render
(
context
,
request
))
template_name
=
"users/users.html"
\ 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