Updated the tally field

parent 31ee0e78
......@@ -18,8 +18,8 @@ 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)
......
......@@ -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>'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment