Commit 139d83e7 authored by Neal Berones's avatar Neal Berones

feat: edited view for the announcements app to display announcements

parent bb7bf5b9
...@@ -2,5 +2,6 @@ from django.urls import path ...@@ -2,5 +2,6 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name='index') path('', views.index, name='index'),
path('welcome', views.welcome, name='welcome')
] ]
...@@ -3,7 +3,7 @@ from django.shortcuts import render ...@@ -3,7 +3,7 @@ from django.shortcuts import render
from .models import WidgetUser, Announcement, Reaction from .models import WidgetUser, Announcement, Reaction
# Create your views here. # Create your views here.
def index(request): def welcome(request):
return HttpResponse("This is the Announcement Board!") return HttpResponse("This is the Announcement Board!")
def index(request): def index(request):
...@@ -16,13 +16,13 @@ def index(request): ...@@ -16,13 +16,13 @@ def index(request):
love_tally=0 love_tally=0
angry_tally=0 angry_tally=0
for r in reactions: for r in reactions:
if r.reaction_name==Like and r.announcement==a: if r.reaction_name=="Like" and r.announcement==a:
like_tally+=r.tally like_tally+=r.tally
elif r.reaction_name==Love and r.announcement==a: elif r.reaction_name=="Love" and r.announcement==a:
love_tally+=r.tally love_tally+=r.tally
elif r.reaction_name==Angry and r.announcement==a: elif r.reaction_name=="Angry" and r.announcement==a:
angry_tally+=r.tally angry_tally+=r.tally
announcement_view += "<br/> {} by {} {} dated {}: <br/> {} <br/> {} <br/> {} <br/> {}".\ announcement_view += "<br/> {} by {} {} dated {}: <br/> {} <br/> Like: {} <br/> Love: {} <br/> Angry: {} <br/>".\
format(a.announcement_title, format(a.announcement_title,
a.author.first_name, a.author.first_name,
a.author.last_name, a.author.last_name,
......
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