From b0cd774bad45c5c694653aee37c0f2ce6855ba51 Mon Sep 17 00:00:00 2001 From: Nils Rokita <0rokita@informatik.uni-hamburg.de> Date: Thu, 26 Dec 2019 22:18:08 +0100 Subject: [PATCH] fix comment ordering --- bitpoll/poll/templates/poll/poll.html | 4 ++-- bitpoll/poll/views.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bitpoll/poll/templates/poll/poll.html b/bitpoll/poll/templates/poll/poll.html index 694987ae..0762914d 100644 --- a/bitpoll/poll/templates/poll/poll.html +++ b/bitpoll/poll/templates/poll/poll.html @@ -208,9 +208,9 @@ {% trans 'Export as CSV' %} -

{% if poll.comment_set.all %}

{% trans 'Comments' %}

{% endif %} +

{% if comments %}

{% trans 'Comments' %}

{% endif %}
- {% for comment in poll.comment_set.all %} + {% for comment in comments %}
{% if comment.user %}{{ comment.user.get_displayname }}{% else %}{{ comment.name }}{% endif %}
diff --git a/bitpoll/poll/views.py b/bitpoll/poll/views.py index de64495c..8e03425b 100644 --- a/bitpoll/poll/views.py +++ b/bitpoll/poll/views.py @@ -176,6 +176,7 @@ def poll(request, poll_url: str, export: bool=False): 'invitations': invitations if current_poll.show_invitations else [], 'summary': summary, 'comment_form': CommentForm(), + 'comments': current_poll.comment_set.order_by('date_created'), 'choice_values': ChoiceValue.objects.filter(poll=current_poll), 'spam_challenge': create_anti_spam_challenge(current_poll.id), })