Commit d064d28b authored by MJoshBen's avatar MJoshBen

Created the Templates folder and Created the Main Announcement Page

parent 79e2ddbc
{% extends 'base.html' %}
{% block title %}Widget's Announcement Board{% endblock %}
{% block content %}
<h1>Welcome to Widget's Announcement Board!</h1>
<h3>
{% for announcement in announcements %}
<a href="{{ announcement.get_absolute_url }}">{{ announcement.name }}</a><br>
{% endfor %}
</h3>
{% endblock %}
{% block scripts %}
<a href="/announcement/add"><input type="submit" value="New Announcement"></a><br><br>
<a href="/dashboard">Dashboard</a><br>
<a href="/assignment">Assignments</a><br>
<a href="/forum">Forum</a><br>
<a href="/calendar">Calendar</a>
{% endblock %}
......@@ -4,14 +4,5 @@ from django.http import HttpResponse
from .models import Announcement, Reaction
def index(request):
page_content ="""<H1>Widget's Announcement Board</H1?"""
for announcement in Announcement.objects.all():
newAnnouncementDateTime = announcement.pub_datetime.strftime("%m-%d-%Y %I:%M %p")
page_content += """<br> <br>
{} by {} published {}:<br>
{}<br>""".format(announcement.title, announcement.author, newAnnouncementDateTime, announcement.body)
for reaction in Reaction.objects.all():
if reaction.announcement == announcement:
page_content += """<br>{}: {}
""".format(reaction.name, reaction.tally)
return HttpResponse(page_content)
return render(request, 'announcement/announcement.html', {'assignments': Announcement.objects.all()})
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