Commit d62ea444 authored by Titia de Castro's avatar Titia de Castro

added announcement detail view

parent 992f3588
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>{{ announcement.announcement_title }}</h1>
<h2>by {{ announcement.author.first_name }} {{ announcement.author.last_name }} dated {{ announcement.pub_date|date:'d/m/Y' }}</h2>
<p>
{{ announcement.announcement_body }}
</p>
{% for reaction in announcement.reactions.all %}
<p>{{ reaction.reaction_name }} Reactions: {{ reaction.getTally }}</p>
{% endfor %}
</body>
</html>
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic.detail import DetailView
from .models import Announcement
......@@ -7,3 +8,6 @@ from .models import Announcement
def index(request):
return render(request, 'index.html', {'announcements': Announcement.objects.order_by('-pub_date')})
class AnnouncementDetailView(DetailView):
model = Announcement
\ No newline at end of file
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