Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm-group3
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 Michael T. Amador
midterm-group3
Commits
5c33f14c
Commit
5c33f14c
authored
May 15, 2023
by
Brendan Fausto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created list view of dashboard users and correspoding template
parent
5ec7a86c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
15 deletions
+69
-15
models.py
widget_group3/dashboard/models.py
+4
-1
dashboard.html
widget_group3/dashboard/templates/dashboard/dashboard.html
+33
-0
urls.py
widget_group3/dashboard/urls.py
+3
-2
views.py
widget_group3/dashboard/views.py
+13
-12
base.html
widget_group3/template/base.html
+16
-0
No files found.
widget_group3/dashboard/models.py
View file @
5c33f14c
...
...
@@ -23,4 +23,7 @@ class WidgetUser(models.Model):
def
__str__
(
self
):
return
'{}, {} {}: {}, {}'
.
format
(
self
.
last_name
,
self
.
first_name
,
self
.
middle_name
,
self
.
dept_name
,
self
.
home_unit
)
\ No newline at end of file
'''
def get_absolute_url(self):
return reverse('dashboard:widgetuser-details', kwargs = {'pk': self.id})
'''
\ No newline at end of file
widget_group3/dashboard/templates/dashboard/dashboard.html
0 → 100644
View file @
5c33f14c
{% extends 'base.html' %}
{% block title %}
Widget v2
{% endblock %}
{% block header %}
<h1>
Welcome to Widget!
</h1>
{% endblock %}
{% block content %}
Widget Users:
<br>
<ul>
{% for object in users %}
<li>
<a
href =
"{{ object.get_absolute_url }}"
>
{{ object.activity }}
</a>
</li>
{% endfor %}
</ul>
<form
action =
"http://127.0.0.1:8000/widgetusers/add"
>
<input
type =
"submit"
value =
"Add Widget User"
/>
</form>
<p>
<a
href =
"http://127.0.0.1:8000/announcements"
>
Announcements
</a>
<a
href =
"http://127.0.0.1:8000/forum"
>
Forum
</a>
<a
href =
"http://127.0.0.1:8000/assignments"
>
Assignments
</a>
<a
href =
"http://127.0.0.1:8000/calendar"
>
Calendar
</a>
</p>
{% endblock %}
\ No newline at end of file
widget_group3/dashboard/urls.py
View file @
5c33f14c
...
...
@@ -2,11 +2,12 @@
from
django.urls
import
path
from
.views
import
index
from
.views
import
dashboard
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
dashboard
,
name
=
'index'
),
]
...
...
widget_group3/dashboard/views.py
View file @
5c33f14c
from
django.shortcuts
import
render
from
django.shortcuts
import
render
,
redirect
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.edit
import
UpdateView
from
django.shortcuts
import
get_object_or_404
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.forms
import
formset_factory
,
BaseFormSet
,
HiddenInput
,
modelform_factory
from
django.http
import
HttpResponse
from
.models
import
WidgetUser
# Create your views here.
def
index
(
request
):
return_string
=
'<body>Welcome to Widget!<br><br>WIDGET USERS:<br><ul>'
for
user
in
WidgetUser
.
objects
.
all
():
user_string
=
'<li>{}</li>'
.
format
(
user
.
__str__
())
return_string
+=
user_string
return_string
+=
'</ul></body>'
html_string
=
'<html>{}</html>'
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
def
dashboard
(
request
):
users
=
WidgetUser
.
objects
.
all
()
return
render
(
request
,
'dashboard/dashboard.html'
,
{
'users'
:
users
})
widget_group3/template/base.html
0 → 100644
View file @
5c33f14c
<!-- bookshelf/template/base.html -->
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<link
rel=
"stylesheet"
href=
"style.css"
>
<title>
{% block title %}{% endblock %}
</title>
</head>
<body
style =
"background-color:#F0FFFF;"
>
{% block header %}
{% endblock %}
<br>
{% block content %}
{% endblock %}
</div>
</body>
</html>
\ 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