Commit acfc7365 authored by Jersey Dayao's avatar Jersey Dayao 🏀

feat: edited def request() to reflect Post-Reply r/s on server

parent f99ce702
No preview for this file type
from django.http import HttpResponse
from .models import Post, Reply
# Create your views here.
def index(request):
return HttpResponse("Welcome to Widget's Forum!")
\ No newline at end of file
post_data = Post.objects.all()
html = '<html><body><h3>FORUM POSTS:</h3>'
for a in post_data:
html += "{} by {} {} dated {}:<br>{}<br>".format(
a.post_title,
a.author.first_name,
a.author.last_name,
a.pub_date,
a.post_body
)
reply_data = Reply.objects.filter(reply_post=a.id)
for b in reply_data:
html += "Reply by {} {} dated {}:<br>{}<br>".format(
b.author.first_name,
b.author.last_name,
b.pub_date,
b.reply_body
)
html += '<br>'
html += '</body></html>'
return HttpResponse(html)
\ 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