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
31ee0e78
Commit
31ee0e78
authored
Apr 06, 2022
by
Julliana Zarah C. Cruz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made and applied migrations
parent
7f30c066
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
0007_remove_reaction_tally_reaction_id.py
...ents/migrations/0007_remove_reaction_tally_reaction_id.py
+23
-0
views.py
widget_group22/announcements/views.py
+4
-4
No files found.
widget_group22/announcements/migrations/0007_remove_reaction_tally_reaction_id.py
0 → 100644
View file @
31ee0e78
# Generated by Django 4.0.3 on 2022-04-06 02:46
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0006_remove_announcement_reaction_reaction_announcement'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'reaction'
,
name
=
'tally'
,
),
migrations
.
AddField
(
model_name
=
'reaction'
,
name
=
'id'
,
field
=
models
.
BigAutoField
(
auto_created
=
True
,
default
=
1
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
),
preserve_default
=
False
,
),
]
widget_group22/announcements/views.py
View file @
31ee0e78
...
...
@@ -16,12 +16,12 @@ def announcements(request):
for
i
in
all_announcements
:
title
=
i
.
announcement_title
body
=
i
.
announcement_body
date
=
i
.
pub_date
date
=
str
(
i
.
pub_date
)
last_name
=
i
.
author
.
last_name
first_name
=
i
.
author
.
first_name
like_tally
=
Reaction
.
objects
.
filter
(
reaction_name
=
'Like'
,
announcement
=
i
)
.
count
(
)
love_tally
=
Reaction
.
objects
.
filter
(
reaction_name
=
'Love'
,
announcement
=
i
)
.
count
(
)
angry_tally
=
Reaction
.
objects
.
filter
(
reaction_name
=
'Angry'
,
announcement
=
i
)
.
count
(
)
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
()
)
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