Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_jenicaesports
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
Christianneil Emmanuel Ocampo
midterm_jenicaesports
Commits
e04995f1
Commit
e04995f1
authored
May 10, 2023
by
Eldon Dagdag
Browse files
Options
Browse Files
Download
Plain Diff
Fixed merge conflicts with master
parents
d8829f75
819d6dba
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
538 additions
and
69 deletions
+538
-69
0007_alter_announcement_pub_datetime.py
..._board/migrations/0007_alter_announcement_pub_datetime.py
+19
-0
models.py
widget_jenicaesports/announcement_board/models.py
+36
-3
announcement-add.html
..._board/templates/announcement_board/announcement-add.html
+42
-0
announcement-details.html
...rd/templates/announcement_board/announcement-details.html
+59
-0
announcement-edit.html
...board/templates/announcement_board/announcement-edit.html
+42
-0
announcements.html
...ent_board/templates/announcement_board/announcements.html
+51
-0
urls.py
widget_jenicaesports/announcement_board/urls.py
+5
-2
views.py
widget_jenicaesports/announcement_board/views.py
+17
-41
0002_alter_widgetuser_department.py
.../dashboard/migrations/0002_alter_widgetuser_department.py
+23
-0
0003_alter_widgetuser_first_name_and_more.py
...d/migrations/0003_alter_widgetuser_first_name_and_more.py
+34
-0
models.py
widget_jenicaesports/dashboard/models.py
+10
-6
dashboard.html
...enicaesports/dashboard/templates/dashboard/dashboard.html
+50
-0
widgetuser-add.html
...esports/dashboard/templates/dashboard/widgetuser-add.html
+41
-0
widgetuser-details.html
...rts/dashboard/templates/dashboard/widgetuser-details.html
+41
-0
widgetuser-edit.html
...sports/dashboard/templates/dashboard/widgetuser-edit.html
+41
-0
urls.py
widget_jenicaesports/dashboard/urls.py
+7
-2
views.py
widget_jenicaesports/dashboard/views.py
+20
-15
No files found.
widget_jenicaesports/announcement_board/migrations/0007_alter_announcement_pub_datetime.py
0 → 100644
View file @
e04995f1
# Generated by Django 4.1.7 on 2023-05-10 05:08
from
django.db
import
migrations
,
models
import
django.utils.timezone
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcement_board'
,
'0006_alter_reaction_announcement'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'announcement'
,
name
=
'pub_datetime'
,
field
=
models
.
DateTimeField
(
default
=
django
.
utils
.
timezone
.
now
),
),
]
widget_jenicaesports/announcement_board/models.py
View file @
e04995f1
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils
import
timezone
from
dashboard
import
models
as
dashboard_models
from
dashboard
import
models
as
dashboard_models
class
Announcement
(
models
.
Model
):
class
Announcement
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
255
,
default
=
""
)
title
=
models
.
CharField
(
max_length
=
255
,
default
=
""
)
body
=
models
.
TextField
(
default
=
""
)
body
=
models
.
TextField
(
default
=
""
)
author
=
models
.
ForeignKey
(
dashboard_models
.
WidgetUser
,
on_delete
=
models
.
CASCADE
)
author
=
models
.
ForeignKey
(
dashboard_models
.
WidgetUser
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
()
pub_datetime
=
models
.
DateTimeField
(
default
=
timezone
.
now
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} by {} {} published on {}: {}'
.
format
(
return
'{} by {} {} published on {}
, {}
: {}'
.
format
(
self
.
title
,
self
.
title
,
self
.
author
.
first_name
,
self
.
author
.
first_name
,
self
.
author
.
last_name
,
self
.
author
.
last_name
,
self
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y
%
I:
%
M
%
p"
),
self
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
y"
),
self
.
pub_datetime
.
strftime
(
"
%
I:
%
M
%
p"
),
self
.
body
self
.
body
)
)
def
formatted_date
(
self
):
return
'{}'
.
format
(
self
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
y"
))
def
formatted_time
(
self
):
return
'{}'
.
format
(
self
.
pub_datetime
.
strftime
(
"
%
I:
%
M
%
p"
))
def
getLikeReactions
(
self
):
try
:
return
'{}'
.
format
(
Reaction
.
objects
.
get
(
name
=
"Like"
,
announcement
=
self
)
.
tally
)
except
:
return
'0'
def
getLoveReactions
(
self
):
try
:
return
'{}'
.
format
(
Reaction
.
objects
.
get
(
name
=
"Love"
,
announcement
=
self
)
.
tally
)
except
:
return
'0'
def
getAngryReactions
(
self
):
try
:
return
'{}'
.
format
(
Reaction
.
objects
.
get
(
name
=
"Angry"
,
announcement
=
self
)
.
tally
)
except
:
return
'0'
def
get_absolute_url
(
self
):
return
reverse
(
'announcement_board:announcement-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Reaction
(
models
.
Model
):
class
Reaction
(
models
.
Model
):
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
,
related_name
=
'reactions'
)
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
,
related_name
=
'reactions'
)
...
...
widget_jenicaesports/announcement_board/templates/announcement_board/announcement-add.html
0 → 100644
View file @
e04995f1
{% extends 'base.html' %}
{% load static %}
{% block title %}Add Announcement{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'announcements_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Announcements
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Add New Announcement
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:50px; color:#052c65"
>
Add a new announcement:
</h1>
</div>
<br>
<div
class=
"row"
></div>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{field.label}}:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
{{field}}
</div>
</div>
<br>
{% endfor %}
<input
type=
"submit"
class=
"btn btn-dark"
value=
"Save New Announcement"
style=
"background-color:#052c65"
>
</form>
<br><br>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/announcement_board/templates/announcement_board/announcement-details.html
0 → 100644
View file @
e04995f1
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.title }}{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'announcements_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Announcements
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Announcement Details
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:55px; color:#052c65"
>
{{ object.title }}
</h1>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h4
style=
"font-size:25px"
>
Author:
</h4>
<h4
style=
"font-size:25px"
>
Date and Time:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.author.first_name }} {{ object.author.last_name }}
</h5>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.formatted_date }}, {{ object.formatted_time }}
</h5>
</div>
</div>
<br>
<div
class=
"row p-2"
style=
"background-color:#e3e4e6"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.body }}
</h5>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h4
style=
"font-size:25px"
>
Like:
</h4>
<h4
style=
"font-size:25px"
>
Love:
</h4>
<h4
style=
"font-size:25px"
>
Angry:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.getLikeReactions }}
</h5>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.getLoveReactions }}
</h5>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.getAngryReactions }}
</h5>
</div>
</div>
<br><br>
<button
type=
"button"
class=
"btn"
style=
"background-color:#e3e4e6"
>
<a
href=
"/announcements/{{object.pk}}/edit"
class=
"link-dark"
>
Edit Announcement
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#052c65"
>
<a
href=
"/announcements/"
class=
"link-light"
>
Back to Announcement Board
</a>
</button>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/announcement_board/templates/announcement_board/announcement-edit.html
0 → 100644
View file @
e04995f1
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Announcement{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'announcements_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Announcements
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Edit Announcement
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:50px; color:#052c65"
>
Edit announcement:
</h1>
</div>
<br>
<div
class=
"row"
></div>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{field.label}}:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
{{field}}
</div>
</div>
<br>
{% endfor %}
<input
type=
"submit"
class=
"btn btn-dark"
value=
"Save Changes"
style=
"background-color:#052c65"
>
</form>
<br><br>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/announcement_board/templates/announcement_board/announcements.html
0 → 100644
View file @
e04995f1
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget's Announcement Board{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'announcements_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Announcements
</h2>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:55px; color:#052c65"
>
Wecome to Widget's Announcement Board!
</h1>
</div>
<br>
<br>
<h5
class=
"display-3"
style=
"font-size:40px; color:#052c65"
>
Announcements:
</h5>
<br>
{% for object in announcements %}
<a
href=
"{{ object.get_absolute_url }}"
class=
"link-dark; display-3"
style=
"font-size:18px; color:#052c65"
>
{{ object.title }} by {{ object.author.first_name }} {{ object.author.last_name }}
</a>
<br>
{% endfor %}
<br><br>
<button
type=
"button"
class=
"btn btn-dark"
style=
"background-color:#e3e4e6"
>
<a
href=
"/announcements/add"
class=
"link-dark"
>
New Announcement
</a>
</button>
<br>
<br>
<br>
<button
type=
"button"
class=
"btn btn-dark"
style=
"background-color:#052c65"
>
<a
href=
"/dashboard/"
class=
"link-light"
>
Dashboard
</a>
</button>
<button
type=
"button"
class=
"btn btn-dark"
style=
"background-color:#334277"
>
<a
href=
"/forum/"
class=
"link-light"
>
Forum
</a>
</button>
<button
type=
"button"
class=
"btn btn-dark"
style=
"background-color:#425086"
>
<a
href=
"/assignments/"
class=
"link-light"
>
Assignments
</a>
</button>
<button
type=
"button"
class=
"btn btn-dark"
style=
"background-color:#515e96"
>
<a
href=
"/calendar/"
class=
"link-light"
>
Calendar
</a>
</button>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/announcement_board/urls.py
View file @
e04995f1
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
announcements
,
AnnouncementDetailView
,
AnnouncementCreateView
,
AnnouncementUpdateView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
announcements
,
name
=
'announcements'
),
path
(
'<int:pk>/details/'
,
AnnouncementDetailView
.
as_view
(),
name
=
'announcement-details'
),
path
(
'add/'
,
AnnouncementCreateView
.
as_view
(),
name
=
'announcement-add'
),
path
(
'<int:pk>/edit/'
,
AnnouncementUpdateView
.
as_view
(),
name
=
'announcement-edit'
),
]
]
app_name
=
"announcement_board"
app_name
=
"announcement_board"
\ No newline at end of file
widget_jenicaesports/announcement_board/views.py
View file @
e04995f1
from
django.shortcuts
import
render
from
django.shortcuts
import
render
,
redirect
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Announcement
from
.models
import
Reaction
def
index
(
request
):
from
.models
import
Announcement
,
Reaction
return_string
=
"<p>Widget's Announcement Board</p> <p>Announcements:<br>"
for
announcements
in
Announcement
.
objects
.
all
():
def
announcements
(
request
):
announcement_string
=
'{} by {} {} published {}, {}:<br>{}<br>'
.
format
(
return
render
(
request
,
'announcement_board/announcements.html'
,
{
'announcements'
:
Announcement
.
objects
.
order_by
(
'-pub_datetime'
)})
announcements
.
title
,
announcements
.
author
.
first_name
,
announcements
.
author
.
last_name
,
announcements
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y"
),
announcements
.
pub_datetime
.
strftime
(
"
%
I:
%
M
%
p"
),
announcements
.
body
)
return_string
+=
announcement_string
reactionList
=
announcements
.
reactions
.
all
()
class
AnnouncementDetailView
(
DetailView
):
sortedReactionList
=
sortReactions
(
reactionList
)
model
=
Announcement
template_name
=
'announcement_board/announcement-details.html'
for
reaction
in
sortedReactionList
:
class
AnnouncementCreateView
(
CreateView
):
reactions_string
=
'{}: {}<br>'
.
format
(
model
=
Announcement
reaction
.
name
,
fields
=
'title'
,
'body'
,
'author'
reaction
.
tally
template_name
=
'announcement_board/announcement-add.html'
)
return_string
+=
reactions_string
return_string
+=
'</p>'
html_string
=
'<html><body>{}</body></html>'
.
format
(
return_string
)
return
HttpResponse
(
return_string
)
class
AnnouncementUpdateView
(
UpdateView
):
model
=
Announcement
# Sorting the reactions to Like, Love, and Angry order.
fields
=
'title'
,
'body'
,
'author'
def
sortReactions
(
list
):
template_name
=
'announcement_board/announcement-edit.html'
sortedReactionList
=
[
''
]
*
3
\ No newline at end of file
for
reaction
in
list
:
if
reaction
.
name
==
"Like"
:
sortedReactionList
[
0
]
=
reaction
elif
reaction
.
name
==
"Love"
:
sortedReactionList
[
1
]
=
reaction
elif
reaction
.
name
==
"Angry"
:
sortedReactionList
[
2
]
=
reaction
return
sortedReactionList
\ No newline at end of file
widget_jenicaesports/dashboard/migrations/0002_alter_widgetuser_department.py
0 → 100644
View file @
e04995f1
# Generated by Django 4.1.6 on 2023-05-04 10:33
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
"dashboard"
,
"0001_initial"
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
"widgetuser"
,
name
=
"department"
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
"dashboard.department"
,
verbose_name
=
"Department, Home Unit"
,
),
),
]
widget_jenicaesports/dashboard/migrations/0003_alter_widgetuser_first_name_and_more.py
0 → 100644
View file @
e04995f1
# Generated by Django 4.1.6 on 2023-05-10 07:26
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
"dashboard"
,
"0002_alter_widgetuser_department"
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
"widgetuser"
,
name
=
"first_name"
,
field
=
models
.
CharField
(
default
=
""
,
max_length
=
255
,
verbose_name
=
"First Name"
),
),
migrations
.
AlterField
(
model_name
=
"widgetuser"
,
name
=
"last_name"
,
field
=
models
.
CharField
(
default
=
""
,
max_length
=
255
,
verbose_name
=
"Last Name"
),
),
migrations
.
AlterField
(
model_name
=
"widgetuser"
,
name
=
"middle_name"
,
field
=
models
.
CharField
(
default
=
""
,
max_length
=
255
,
verbose_name
=
"Middle Name"
),
),
]
widget_jenicaesports/dashboard/models.py
View file @
e04995f1
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
class
Department
(
models
.
Model
):
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
255
,
default
=
''
)
dept_name
=
models
.
CharField
(
max_length
=
255
,
default
=
''
)
home_unit
=
models
.
CharField
(
max_length
=
255
,
default
=
''
)
home_unit
=
models
.
CharField
(
max_length
=
255
,
default
=
''
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'
Department Name and Home Unit:
{}, {}'
.
format
(
self
.
dept_name
,
self
.
home_unit
)
return
'{}, {}'
.
format
(
self
.
dept_name
,
self
.
home_unit
)
class
WidgetUser
(
models
.
Model
):
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
255
,
default
=
''
)
first_name
=
models
.
CharField
(
max_length
=
255
,
default
=
''
,
verbose_name
=
'First Name'
)
middle_name
=
models
.
CharField
(
max_length
=
255
,
default
=
''
)
middle_name
=
models
.
CharField
(
max_length
=
255
,
default
=
''
,
verbose_name
=
'Middle Name'
)
last_name
=
models
.
CharField
(
max_length
=
255
,
default
=
''
)
last_name
=
models
.
CharField
(
max_length
=
255
,
default
=
''
,
verbose_name
=
'Last Name'
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
,
verbose_name
=
'Department, Home Unit'
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'{}, {} {}'
.
format
(
self
.
last_name
,
self
.
first_name
,
self
.
middle_name
)
return
'{}, {}'
.
format
(
self
.
last_name
,
self
.
first_name
)
\ No newline at end of file
def
get_absolute_url
(
self
):
return
reverse
(
'dashboard:widgetuser-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
widget_jenicaesports/dashboard/templates/dashboard/dashboard.html
0 → 100644
View file @
e04995f1
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget v2{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'dashboard_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Dashboard
</h2>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:60px; color:#052c65"
>
Welcome to Widget!
</h1>
</div>
<br>
<br>
<h6
class=
"display-3"
style=
"font-size:40px; color:#052c65"
>
Widget Users:
</h6><br>
{% for user in users %}
<a
href=
"{{ user.get_absolute_url }}"
class=
"link-dark; display-3"
style=
"font-size:18px; color:#052c65"
>
{{ user }}
</a>
<br>
{% endfor %}
<br><br>
<button
type=
"button"
class=
"btn"
style=
"background-color:#e3e4e6"
>
<a
href=
"/dashboard/widgetusers/add/"
class=
"link-dark"
>
Add Widget User
</a>
</button>
<br>
<br>
<br>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#052c65"
>
<a
href=
"/announcements/"
class=
"link-light"
>
Announcement Board
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#334277"
>
<a
href=
"/forum/"
class=
"link-light"
>
Forum
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#425086"
>
<a
href=
"/assignments/"
class=
"link-light"
>
Assignments
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#515e96"
>
<a
href=
"/calendar/"
class=
"link-light"
>
Calendar
</a>
</button>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/dashboard/templates/dashboard/widgetuser-add.html
0 → 100644
View file @
e04995f1
{% extends 'base.html' %}
{% load static %}
{% block title %}Add Widget User{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'dashboard_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Dashboard
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Add Widget User
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:50px; color:#052c65"
>
Add a new widget user:
</h1>
</div>
<br>
<div
class=
"row"
></div>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{field.label}}:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
{{field}}
</div>
</div>
<br>
{% endfor %}
<input
type=
"submit"
class=
"btn btn-dark"
value=
"Add Widget User"
style=
"background-color:#052c65"
>
</form>
<br><br>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/dashboard/templates/dashboard/widgetuser-details.html
0 → 100644
View file @
e04995f1
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object }}{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'dashboard_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Dashboard
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Widget User Details
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:50px; color:#052c65"
>
{{ object.first_name }} {{ object.middle_name }} {{ object.last_name }}
</h1>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h4
style=
"font-size:25px"
>
Department Name:
</h4>
<h4
style=
"font-size:25px"
>
Home Unit:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.department.dept_name }}
</h5>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.department.home_unit }}
</h5>
</div>
</div>
<br><br>
<button
type=
"button"
class=
"btn"
style=
"background-color:#e3e4e6"
>
<a
href=
"/dashboard/widgetusers/{{ object.pk }}/edit/"
class=
"link-dark"
>
Edit Widget User
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#052c65"
>
<a
href=
"/dashboard/"
class=
"link-light"
>
Back to Dashboard
</a>
</button>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/dashboard/templates/dashboard/widgetuser-edit.html
0 → 100644
View file @
e04995f1
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Widget User{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'dashboard_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Dashboard
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Edit Widget User
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:50px; color:#052c65"
>
Edit Widget User:
</h1>
</div>
<br>
<div
class=
"row"
></div>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{field.label}}:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
{{field}}
</div>
</div>
<br>
{% endfor %}
<input
type=
"submit"
class=
"btn btn-dark"
value=
"Save Changes to Widget User"
style=
"background-color:#052c65"
>
</form>
<br><br>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/dashboard/urls.py
View file @
e04995f1
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
(
dashboard_view
,
WidgetUserDetailView
,
WidgetUserCreateView
,
WidgetUserUpdateView
)
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
)
path
(
''
,
dashboard_view
,
name
=
'dashboard'
),
path
(
'widgetusers/<int:pk>/details/'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser-details'
),
path
(
'widgetusers/add/'
,
WidgetUserCreateView
.
as_view
(),
name
=
'widgetuser-add'
),
path
(
'widgetusers/<int:pk>/edit/'
,
WidgetUserUpdateView
.
as_view
(),
name
=
'widgetuser-edit'
),
]
]
app_name
=
'dashboard'
app_name
=
'dashboard'
\ No newline at end of file
widget_jenicaesports/dashboard/views.py
View file @
e04995f1
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
WidgetUser
from
.models
import
WidgetUser
def
index
(
request
):
def
dashboard_view
(
request
):
return_string
=
'<p>Welcome to Widget!</p> <p>WIDGET USERS:<br>'
users
=
WidgetUser
.
objects
.
all
()
context
=
{
'users'
:
users
}
for
user
in
WidgetUser
.
objects
.
all
():
return
render
(
request
,
'dashboard/dashboard.html'
,
context
)
user_string
=
'{}, {} {}: {}, {}<br>'
.
format
(
user
.
last_name
,
user
.
first_name
,
user
.
middle_name
,
class
WidgetUserDetailView
(
DetailView
):
user
.
department
.
dept_name
,
user
.
department
.
home_unit
model
=
WidgetUser
)
template_name
=
'dashboard/widgetuser-details.html'
return_string
+=
user_string
class
WidgetUserCreateView
(
CreateView
):
return_string
+=
'</p>'
model
=
WidgetUser
html_string
=
'<html><body>{}</body></html>'
.
format
(
return_string
)
fields
=
'__all__'
template_name
=
'dashboard/widgetuser-add.html'
return
HttpResponse
(
return_string
)
\ No newline at end of file
class
WidgetUserUpdateView
(
UpdateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'dashboard/widgetuser-edit.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