Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group22
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 Tamano
widget_group22
Commits
4558cfc7
Commit
4558cfc7
authored
Apr 06, 2022
by
Julliana Zarah C. Cruz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated the tally field
parent
31ee0e78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
models.py
widget_group22/announcements/models.py
+2
-2
views.py
widget_group22/announcements/views.py
+4
-4
No files found.
widget_group22/announcements/models.py
View file @
4558cfc7
...
...
@@ -18,7 +18,7 @@ class Reaction(models.Model):
max_length
=
5
,
choices
=
REACTION_CHOICES
,
)
tally
=
1
tally
=
models
.
IntegerField
(
default
=
1
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
reaction_name
)
...
...
widget_group22/announcements/views.py
View file @
4558cfc7
...
...
@@ -9,7 +9,7 @@ def index(request):
def
announcements
(
request
):
all_announcements
=
models
.
Announcement
.
objects
.
all
()
#
all_reactions = models.Reaction.objects.all()
all_reactions
=
models
.
Reaction
.
objects
.
all
()
final_output
=
''
...
...
@@ -19,9 +19,9 @@ def announcements(request):
date
=
str
(
i
.
pub_date
)
last_name
=
i
.
author
.
last_name
first_name
=
i
.
author
.
first_name
like_tally
=
str
(
Reaction
.
objects
.
filter
(
reaction_name
=
'Like'
,
announcement
=
i
)
.
count
()
)
love_tally
=
str
(
Reaction
.
objects
.
filter
(
reaction_name
=
'Love'
,
announcement
=
i
)
.
count
()
)
angry_tally
=
str
(
Reaction
.
objects
.
filter
(
reaction_name
=
'Angry'
,
announcement
=
i
)
.
count
()
)
like_tally
=
Reaction
.
objects
.
filter
(
reaction_name
=
'Like'
,
announcement
=
i
)
love_tally
=
Reaction
.
objects
.
filter
(
reaction_name
=
'Love'
,
announcement
=
i
)
angry_tally
=
Reaction
.
objects
.
filter
(
reaction_name
=
'Angry'
,
announcement
=
i
)
output
=
(
title
+
' by '
+
first_name
+
' '
+
last_name
+
' dated '
+
date
+
':<br>'
+
body
+
'<br>'
...
...
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