Commit 069c0f7f authored by Migs Atienza's avatar Migs Atienza

Added forum.html (no working post links)

parent 9294054e
{% extends 'base.html' %}
{% block title %}Widget's Forum{% endblock %}
{% block content %}
<h1>Welcome to Widget's Forum!</h1>
<h3>
{% for post in forumposts %}
<a href="{{ forum.get_absolute_url }}">{{ post.title }} by {{ post.author }}</a><br>
{% endfor %}
</h3>
{% endblock %}
{% block scripts %}
<a href="/dashboard">Dashboard</a><br>
<a href="/announcement">Announcements</a><br>
<a href="/assignments">Assignments</a><br>
<a href="/calendar">Calendar</a>
{% endblock %}
\ No newline at end of file
...@@ -5,19 +5,6 @@ from .models import ForumPost, Reply ...@@ -5,19 +5,6 @@ from .models import ForumPost, Reply
def index(request): def index(request):
page_content = """<H1>Widget’s Forum</H1>""" return render(request, 'forum/forum.html', {'forumposts': ForumPost.objects.all()})
for forum in ForumPost.objects.all():
newForumDateTime = forum.pub_datetime.strftime("%m-%d-%Y %I:%M %p")
page_content += """<br>
{} by {} posted {}:<br>
{}<br>
""".format(forum.title, forum.author, newForumDateTime, forum.body)
for reply in Reply.objects.all():
if reply.forum_post == forum:
newReplyDateTime = reply.pub_datetime.strftime("%m-%d-%Y %I:%M %p")
page_content += """Reply by {} posted {}:<br>
{}<br>
""".format(reply.author, newReplyDateTime, reply.body)
return HttpResponse(page_content)
# Create your views here. # Create your views here.
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