Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_k3git
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
Stefan Gomez
midterm_k3git
Commits
4ea9aa33
Commit
4ea9aa33
authored
May 08, 2023
by
Stefan Gomez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented the "Per Widget User Details Page".
parent
c939e1c1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
4 deletions
+30
-4
models.cpython-311.pyc
widget_k3git/dashboard/__pycache__/models.cpython-311.pyc
+0
-0
urls.cpython-311.pyc
widget_k3git/dashboard/__pycache__/urls.cpython-311.pyc
+0
-0
views.cpython-311.pyc
widget_k3git/dashboard/__pycache__/views.cpython-311.pyc
+0
-0
models.py
widget_k3git/dashboard/models.py
+7
-1
dashboard.html
widget_k3git/dashboard/templates/dashboard/dashboard.html
+1
-1
widgetuser-details.html
...git/dashboard/templates/dashboard/widgetuser-details.html
+11
-0
urls.py
widget_k3git/dashboard/urls.py
+2
-1
views.py
widget_k3git/dashboard/views.py
+9
-1
No files found.
widget_k3git/dashboard/__pycache__/models.cpython-311.pyc
View file @
4ea9aa33
No preview for this file type
widget_k3git/dashboard/__pycache__/urls.cpython-311.pyc
View file @
4ea9aa33
No preview for this file type
widget_k3git/dashboard/__pycache__/views.cpython-311.pyc
View file @
4ea9aa33
No preview for this file type
widget_k3git/dashboard/models.py
View file @
4ea9aa33
...
...
@@ -21,3 +21,9 @@ class WidgetUser(models.Model):
def
name_shortcut
(
self
):
return
'{}, {}'
.
format
(
self
.
last_name
,
self
.
first_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'dashboard:widgetuser-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
name_shortcut2
(
self
):
return
'{} {} {}'
.
format
(
self
.
first_name
,
self
.
middle_name
,
self
.
last_name
)
\ No newline at end of file
widget_k3git/dashboard/templates/dashboard/dashboard.html
View file @
4ea9aa33
...
...
@@ -6,7 +6,7 @@
<h1>
Widget Users:
</h1>
<h3>
{% for widgetuser in widgetusers %}
{{ widgetuser.name_shortcut }}
<br>
<a
href=
"{{ widgetuser.get_absolute_url }}"
>
{{ widgetuser.name_shortcut }}
</a>
<br>
{% endfor %}
</h3>
{% endblock %}
...
...
widget_k3git/dashboard/templates/dashboard/widgetuser-details.html
0 → 100644
View file @
4ea9aa33
{% extends 'base.html' %}
{% block title %}{{ widgetuser.name_shortcut }}{% endblock %}
{% block content %}
<h1>
{{ widgetuser.name_shortcut2 }}
</h1>
<h3>
{{ widgetuser.department.dept_name}}
</h3>
<h3>
{{ widgetuser.department.home_unit}}
</h3>
{% endblock %}
{% block scripts %}
<input
type=
"submit"
value=
"Edit Widget User"
>
{% endblock %}
\ No newline at end of file
widget_k3git/dashboard/urls.py
View file @
4ea9aa33
from
django.contrib
import
admin
from
django.urls
import
path
from
.views
import
index
from
.views
import
index
,
WidgetUserDetailView
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
'<int:pk>/details'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser-details'
),
]
app_name
=
"dashboard"
\ No newline at end of file
widget_k3git/dashboard/views.py
View file @
4ea9aa33
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
.
models
import
Department
,
WidgetUser
from
.
models
import
WidgetUser
def
index
(
request
):
return
render
(
request
,
'dashboard/dashboard.html'
,
{
'widgetusers'
:
WidgetUser
.
objects
.
all
()})
class
WidgetUserDetailView
(
DetailView
):
model
=
WidgetUser
def
get
(
self
,
request
,
pk
):
return
render
(
request
,
'dashboard/widgetuser-details.html'
,
{
'widgetuser'
:
self
.
model
.
objects
.
get
(
pk
=
pk
)})
\ 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