Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group 25
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
Andre Matthew Dumandan
widget_group 25
Commits
3c614762
Commit
3c614762
authored
Apr 01, 2022
by
Alia Lawraine Olay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edited views.py to display Announcement entries
parent
1eafa94e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
views.cpython-310.pyc
...up_25/announcementboard/__pycache__/views.cpython-310.pyc
+0
-0
views.py
widget_group_25/announcementboard/views.py
+15
-1
No files found.
widget_group_25/announcementboard/__pycache__/views.cpython-310.pyc
View file @
3c614762
No preview for this file type
widget_group_25/announcementboard/views.py
View file @
3c614762
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Announcement
def
index
(
request
):
return
HttpResponse
(
"This is the Announcement Board!"
)
heading
=
'ANNOUNCEMENTS:<br>'
all_announcements
=
Announcement
.
objects
.
all
()
body
=
''
for
announcement
in
all_announcements
:
count_like
=
announcement
.
reactions
.
filter
(
reaction_name
=
'Like'
)
.
count
()
count_love
=
announcement
.
reactions
.
filter
(
reaction_name
=
'Love'
)
.
count
()
count_angry
=
announcement
.
reactions
.
filter
(
reaction_name
=
'Angry'
)
.
count
()
body
+=
'{} by {} {} dated {}:<br>{}<br>Like: {}<br>Love: {}<br>Angry: {}<br><br>'
.
format
(
announcement
.
announcement_title
,
announcement
.
author
.
first_name
,
announcement
.
author
.
last_name
,
announcement
.
pub_date
,
announcement
.
announcement_body
,
count_like
,
count_love
,
count_angry
)
return
HttpResponse
(
heading
+
body
)
\ 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