Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_jupert
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
Joseph Izon
widget_jupert
Commits
fa35421b
Commit
fa35421b
authored
May 25, 2022
by
Joseph Izon
💀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the def index and add a new def detail
parent
4c0f12a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
views.py
widget_jupert/homepage/views.py
+27
-2
No files found.
widget_jupert/homepage/views.py
View file @
fa35421b
from
urllib
import
response
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
homepage.models
import
WidgetUser
from
homepage.models
import
Department
# Create your views here.
def
index
(
request
):
user_list
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
context
=
{
"user_list"
:
user_list
}
return
render
(
request
,
"homepage/index.html"
,
context
)
def
detail
(
request
,
id_num
):
dept_list
=
Department
.
objects
.
order_by
(
"dept_name"
)
#error handling
try
:
users
=
WidgetUser
.
objects
.
get
(
pk
=
id_num
)
except
WidgetUser
.
DoesNotExist
:
raise
Http404
(
"User does not exist."
)
return
render
(
request
,
"homepage/detail.html"
,
{
"users"
:
users
,
'dept_list'
:
dept_list
})
"""
widgetuser_objects = WidgetUser.objects.all()
department_objects = Department.objects.all()
...
...
@@ -18,4 +42,5 @@ def index(request):
+ f"{dept.dept_name}, {dept.home_unit}<br>"
)
return
HttpResponse
(
title
+
response
)
\ No newline at end of file
return HttpResponse(title + response)
"""
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