update: modified the details for the forum posts and replies as per the specs

parent b4484b2e
......@@ -4,13 +4,7 @@
<h1>{{ post.post_title }}</h1>
<h3>by {{ post.author.first_name }} {{ post.author.last_name }}, {{ post.pub_date|date:"SHORT_DATE_FORMAT" }}</h3>
<p>{{ post.post_body }}</p>
{% if reply.associated_post is post %}
<ul>
{% for reply in reply_list %}
<li>{{ reply.reply_body }}</li>
{% endfor %}
<li>{{ reply.author.first_name }} {{ reply.author.last_name }}, {{ reply.pub_date|date:"SHORT_DATE_FORMAT" }}: {{ reply.reply_body }}</li>
</ul>
{% else %}
<p>No replies available for this post.</p>
{% endif %}
{% endblock %}
\ No newline at end of file
{% extends "forum/base.html" %}
{% block content%}
<h2>Forum Posts:</h2>
{% if posts_list %}
<ul>
{% for post in posts_list %}
......
......@@ -19,9 +19,10 @@ def index(request):
def detail(request, post_id):
try:
post = Post.objects.get(pk=post_id)
reply = Reply.objects.get(associated_post_id=post_id)
except Post.DoesNotExist:
raise Http404("Post does not exist!")
return render(request, "forum/detail.html", {"post": post})
return render(request, "forum/detail.html", {"post": post, "reply": reply})
# return HttpResponse("These are the details for post # %s" % author_id)
# def welcome(request):
......
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