Commit 23908c11 authored by Eury See's avatar Eury See

Implemented the views and URLs portion of the Forum application.

parent 53af0f91
from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from .models import ForumPost
from .models import Reply
def index(request): def index(request):
return HttpResponse('Hello World! This came from the index view') return_string = "<br>"
\ No newline at end of file for reply in Reply.objects.all():
return_string += '{} by {} posted {}, {}: <br> {} <br> Reply by {} posted {}, {}: <br> {}'.format(
reply.reply_to.title, reply.reply_to.author, reply.reply_to.pub_datetime.strftime("%m/%d/%Y"), reply.reply_to.pub_datetime.strftime("%I:%M %p"), reply.reply_to.body,
reply.author, reply.pub_datetime.strftime("%m/%d/%Y"), reply.pub_datetime.strftime("%I:%M %p"), reply.body
)
return_string += "<br><br>"
html_string = "<html><head> Widget's Forum <br><br> Forum Posts: </head><body> {} </body><html>".format(return_string)
return HttpResponse(html_string)
\ 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