Commit f691394d authored by justin's avatar justin

Formatting fixes

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