fix pub_date format in Forum post details, use newest first order in replies

parent 6cebb156
......@@ -14,12 +14,12 @@
<article>
<img id="thumbnail" src="{% static 'Forum/thumbnail.jpg' %}" alt="placeholder image" />
<h1 id="title">{{ post.post_title }}</h1>
<h4 id="subtitle">by {{ post.author.first_name }} {{ post.author.last_name }}, {{ post.pub_date|date:"m/d/Y" }}</h4>
<h4 id="subtitle">by {{ post.author.first_name }} {{ post.author.last_name }}, {{ post.pub_date|date:"d/m/Y" }}</h4>
<p class="body-text">{{ post.post_body }}</p>
<ul class="replies">
{% for reply in post.reply_set.all %}
<li><strong>{{ reply.author.first_name }} {{ reply.author.last_name }}, {{ reply.pub_date|date:"m/d/Y" }}:</strong> {{ reply.reply_body }}</li>
{% for reply in replies_sorted %}
<li><strong>{{ reply.author.first_name }} {{ reply.author.last_name }}, {{ reply.pub_date|date:"d/m/Y" }}:</strong> {{ reply.reply_body }}</li>
{% endfor %}
</ul>
</article>
......
......@@ -29,4 +29,4 @@ def details(request, post_id):
post = Post.objects.get(pk=post_id)
except Post.DoesNotExist:
raise Http404('Post does not exist')
return render(request, 'Forum/details.html', {'post': post})
\ No newline at end of file
return render(request, 'Forum/details.html', {'post': post, 'replies_sorted': post.reply_set.order_by('-pub_date')})
\ 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