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
01b7857e
Commit
01b7857e
authored
May 27, 2022
by
Joseph Izon
💀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the def add for the add users
parent
bffd88c2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
views.py
widget_jupert/homepage/views.py
+15
-6
No files found.
widget_jupert/homepage/views.py
View file @
01b7857e
from
urllib
import
response
from
urllib
import
response
from
django.http
import
HttpResponse
,
Http404
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
django.shortcuts
import
render
,
redirect
from
homepage.models
import
WidgetUser
from
homepage.models
import
WidgetUser
from
homepage.models
import
Department
from
.forms
import
WidgetUserForm
# Create your views here.
# Create your views here.
def
index
(
request
):
def
index
(
request
):
...
@@ -18,7 +18,6 @@ def index(request):
...
@@ -18,7 +18,6 @@ def index(request):
def
detail
(
request
,
id_num
):
def
detail
(
request
,
id_num
):
dept_list
=
Department
.
objects
.
order_by
(
"dept_name"
)
#error handling
#error handling
try
:
try
:
...
@@ -26,7 +25,17 @@ def detail (request, id_num):
...
@@ -26,7 +25,17 @@ def detail (request, id_num):
except
WidgetUser
.
DoesNotExist
:
except
WidgetUser
.
DoesNotExist
:
raise
Http404
(
"User does not exist."
)
raise
Http404
(
"User does not exist."
)
return
render
(
request
,
"homepage/detail.html"
,
{
"users"
:
users
,
'dept_list'
:
dept_list
})
return
render
(
request
,
"homepage/detail.html"
,
{
"users"
:
users
})
def
add
(
request
):
if
request
.
method
==
"POST"
:
user_form
=
WidgetUserForm
(
request
.
POST
,
request
.
FILES
)
if
user_form
.
is_valid
():
user_form
.
save
()
return
redirect
(
"homepages:add"
)
else
:
user_form
=
WidgetUserForm
()
return
render
(
request
,
"homepage/add.html"
,
{
"user_form"
:
user_form
})
"""
"""
...
...
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