Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_appappandaway
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
Ian Rafael T. Aragoza
midterm_appappandaway
Commits
318e225a
Commit
318e225a
authored
May 12, 2023
by
Ian Rafael T. Aragoza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added bootstrap styling, links for dashboard main page
parent
e5514ee5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
10 deletions
+47
-10
models.py
widget_appappandaway/dashboard/models.py
+2
-2
dashboard.html
...ppappandaway/dashboard/templates/dashboard/dashboard.html
+28
-0
urls.py
widget_appappandaway/dashboard/urls.py
+4
-2
views.py
widget_appappandaway/dashboard/views.py
+12
-5
settings.py
widget_appappandaway/widget_appappandaway/settings.py
+1
-1
No files found.
widget_appappandaway/dashboard/models.py
View file @
318e225a
...
@@ -11,7 +11,7 @@ class Department(models.Model):
...
@@ -11,7 +11,7 @@ class Department(models.Model):
return
'{}'
.
format
(
self
.
dept_name
)
return
'{}'
.
format
(
self
.
dept_name
)
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'department_detail'
,
args
=
[
str
(
self
.
dept_name
)])
return
f
"{self.pk}"
class
WidgetUser
(
models
.
Model
):
class
WidgetUser
(
models
.
Model
):
...
@@ -24,4 +24,4 @@ class WidgetUser(models.Model):
...
@@ -24,4 +24,4 @@ class WidgetUser(models.Model):
return
'{}, {} {}'
.
format
(
self
.
last_name
,
self
.
first_name
,
self
.
middle_name
)
return
'{}, {} {}'
.
format
(
self
.
last_name
,
self
.
first_name
,
self
.
middle_name
)
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'user_detail'
,
args
=
[
str
(
self
.
last_name
)])
return
f
"{self.pk}"
widget_appappandaway/dashboard/templates/dashboard/dashboard.html
0 → 100644
View file @
318e225a
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget v2{% endblock %}
{% block content %}
<div
class=
"container-fluid p-3 bg-dark text-white text-center"
>
<br>
<h1
class=
"display-4"
>
Welcome to Widget!
</h1>
<br>
</div>
<div
class=
"container my-5 text-center"
>
<h3
class=
"display-6"
>
Widget Users:
</h3>
<br>
{% for object in object_list %}
<p><a
href=
"{{ object.get_absolute_url }}/details/"
>
{{ object.last_name }}, {{ object.first_name }}
</a></p>
{% endfor %}
<br><br>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-6"
>
<a
href=
"/widgetusers/add"
><button
type=
"button"
class=
"btn btn-primary"
>
Add Widget User
</button></a>
</div>
<div
class=
"col-6"
>
<a
href=
"/announcements"
><button
type=
"button"
class=
"btn btn-primary"
>
Announcements
</button></a>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_appappandaway/dashboard/urls.py
View file @
318e225a
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
dashboard
,
addUser
,
userDetails
# Create your views here.
# Create your views here.
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
dashboard
,
name
=
'index'
),
path
(
'widgetusers/add/'
,
addUser
,
name
=
'add-user'
),
path
(
'widgetusers/<int:pk>/details/'
,
userDetails
,
name
=
'user-details'
),
]
]
app_name
=
"dashboard"
app_name
=
"dashboard"
widget_appappandaway/dashboard/views.py
View file @
318e225a
...
@@ -5,8 +5,15 @@ from .models import WidgetUser
...
@@ -5,8 +5,15 @@ from .models import WidgetUser
# Create your views here.
# Create your views here.
def
index
(
request
):
def
dashboard
(
request
):
output
=
"<h1>Welcome to Widget!</h1><h3>WIDGET USERS:</h3>"
users
=
WidgetUser
.
objects
.
all
()
userList
=
WidgetUser
.
objects
.
order_by
(
'last_name'
)
context
=
{
output
+=
'<br>'
.
join
([
'{}, {} {}: {}, {}'
.
format
(
user
.
last_name
,
user
.
first_name
,
user
.
middle_name
,
user
.
department
,
user
.
department
.
home_unit
)
for
user
in
userList
])
'object_list'
:
users
return
HttpResponse
(
output
)
}
return
render
(
request
,
'dashboard/dashboard.html'
,
context
)
def
addUser
(
request
):
return
render
(
request
,
'dashboard.html'
)
def
userDetails
(
request
):
return
render
(
request
,
'dashboard.html'
)
widget_appappandaway/widget_appappandaway/settings.py
View file @
318e225a
...
@@ -43,7 +43,7 @@ INSTALLED_APPS = [
...
@@ -43,7 +43,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles'
,
'django.contrib.staticfiles'
,
'dashboard'
,
'dashboard'
,
'announcementboard'
,
'announcementboard'
,
'
forum
'
,
'
bootstrap5
'
,
]
]
MIDDLEWARE
=
[
MIDDLEWARE
=
[
...
...
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