Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_casanatics
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
John Aidan Vincent M. Ng
midterm_casanatics
Commits
6130be80
Commit
6130be80
authored
Mar 04, 2023
by
justin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dashboard_wip'
parents
fd90c34d
f795d2e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
5 deletions
+44
-5
models.py
widget_casanatics/dashboard/models.py
+23
-1
urls.py
widget_casanatics/dashboard/urls.py
+7
-0
views.py
widget_casanatics/dashboard/views.py
+11
-2
urls.py
widget_casanatics/widget_casanatics/urls.py
+3
-2
No files found.
widget_casanatics/dashboard/models.py
View file @
6130be80
from
django.db
import
models
# Create your models here.
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
255
)
home_unit
=
models
.
CharField
(
max_length
=
255
)
def
__str__
(
self
):
return
f
"{self.dept_name}, {self.home_unit}"
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
255
)
middle_name
=
models
.
CharField
(
max_length
=
255
)
last_name
=
models
.
CharField
(
max_length
=
255
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
,
)
def
__str__
(
self
):
return
f
"{self.last_name}, {self.first_name} {self.middle_name}"
def
displayName
(
self
):
return
f
"{self.first_name} {self.last_name}"
widget_casanatics/dashboard/urls.py
0 → 100644
View file @
6130be80
from
django.urls
import
path
from
.
import
views
urlpatterns
=
[
path
(
""
,
views
.
dashboard
,
name
=
"dashboard"
),
]
widget_casanatics/dashboard/views.py
View file @
6130be80
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Department
,
WidgetUser
# Create your views here.
def
dashboard
(
request
):
content
=
"Welcome to Widget! <br><br> WIDGET USERS: <br>"
users
=
WidgetUser
.
objects
.
all
()
for
user
in
users
:
content
+=
str
(
user
)
+
str
(
user
.
department
)
+
"<br>"
return
HttpResponse
(
content
)
widget_casanatics/widget_casanatics/urls.py
View file @
6130be80
...
...
@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from
django.contrib
import
admin
from
django.urls
import
path
from
django.urls
import
path
,
include
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
"admin/"
,
admin
.
site
.
urls
),
path
(
"dashboard/"
,
include
(
"dashboard.urls"
)),
]
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