Commit f691394d authored by justin's avatar justin

Formatting fixes

parent a4affa42
from django.shortcuts import render
from django.http import HttpResponse
from .models import ForumPost, Reply
# Create your views here.
def forum(request):
forum_view=""
# fetch forum posts and replies
forum = ForumPost.objects.all()
replies = Reply.objects.all()
forum_view = "Widget's Forum <br> <br> Forum Posts:<br>"
for post in forum:
forum_view += '''
forum_view += """
{} by {} posted {}: <br>
{} <br>
'''.format(
""".format(
post.title,
post.author,
post.pub_datetime.strftime("%m/%d/%Y, %I:%M %p"),
......@@ -25,13 +22,13 @@ def forum(request):
# Check if reply is for that specific forum_post
for reply in replies:
if reply.forum == post:
forum_view += '''
forum_view += """
Reply by {} posted {}: <br>
{} <br>
'''.format(
""".format(
reply.author,
reply.pub_datetime.strftime("%m/%d/%Y, %I:%M %p"),
reply.body
reply.body,
)
forum_view += "<br>"
return HttpResponse(forum_view)
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