Commit 12c0d0d7 authored by Agu Syquia's avatar Agu Syquia

Updated views.py

Added a nested function in the AnnouncementDetailsView CBV for a variable to be used in the respective template
parent efae50f5
...@@ -14,6 +14,12 @@ class AnnouncementsDetailsView(DetailView): ...@@ -14,6 +14,12 @@ class AnnouncementsDetailsView(DetailView):
model = Announcement model = Announcement
template_name = 'announcement-details.html' template_name = 'announcement-details.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['reactions'] = Reaction.objects.all()
return context
# add announcement, CBV implementation # add announcement, CBV implementation
class AnnouncementsAddView(CreateView): class AnnouncementsAddView(CreateView):
model = Announcement model = Announcement
......
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