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), })