Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_CtrlF
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
Fritzie Dianne Del Pilar
midterm_CtrlF
Commits
929a2561
Commit
929a2561
authored
May 15, 2023
by
Mary Adelaide A. Salto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified views.py to apply the needed FBV and CBV implementations for the dashboard app's pages.
parent
b7630982
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
views.py
widget_CtrlF/dashboard/views.py
+23
-10
No files found.
widget_CtrlF/dashboard/views.py
View file @
929a2561
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Department
,
WidgetUser
from
.models
import
WidgetUser
def
index
(
request
):
def
dashboard
(
request
):
return_string
=
'<p>Welcome to Widget!</p> WIDGET USERS:<br>'
users
=
WidgetUser
.
objects
.
all
()
for
user
in
WidgetUser
.
objects
.
all
():
return
render
(
request
,
'dashboard/dashboard.html'
,
{
'users'
:
users
})
return_string
+=
'{}, {} {}: {}, {}<br>'
.
format
(
user
.
last_name
,
user
.
first_name
,
user
.
middle_name
,
user
.
department
.
dept_name
,
user
.
department
.
home_unit
)
class
WidgetUserDetailView
(
DetailView
):
html_string
=
'<html><body>{}</body></html>'
.
format
(
return_string
)
model
=
WidgetUser
return
HttpResponse
(
html_string
)
template_name
=
'dashboard/widgetuser-details.html'
\ No newline at end of file
class
WidgetUserCreateView
(
CreateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'dashboard/widgetuser-add.html'
class
WidgetUserUpdateView
(
UpdateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'dashboard/widgetuser-edit.html'
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