diff --git a/commentaries/templates/commentaries/commentaries.html b/commentaries/templates/commentaries/commentaries.html index 281bd1a67b0bc977a0e87588f5115d8df79d8ef8..2501faa91b19e84ceb838b1b8c72c770c8130ed2 100644 --- a/commentaries/templates/commentaries/commentaries.html +++ b/commentaries/templates/commentaries/commentaries.html @@ -49,6 +49,19 @@ </section> + +{% if comment_recent_list %} +<section> + <hr class="hr12"> + <h2>Recent Comments</h2> + <ul> + {% for comment in comment_recent_list %} + {{ comment.simple_header_as_li }} + {% endfor %} + </ul> +</section> +{% endif %} + {% if commentary_recent_list %} <section> <hr class="hr12"> diff --git a/commentaries/views.py b/commentaries/views.py index cfa53fbbc1350fab8301c96c39c7ebcdccfdc4d6..07e987d0c43966a0f082f7d9c4738a8b4032e54e 100644 --- a/commentaries/views.py +++ b/commentaries/views.py @@ -308,9 +308,13 @@ def commentaries(request): form = CommentarySearchForm() commentary_search_list = [] + comment_recent_list = (Comment.objects.filter(status='1') + .order_by('-date_submitted')[:10]) + commentary_recent_list = (Commentary.objects.filter(vetted=True) .order_by('-latest_activity')[:10]) context = {'form': form, 'commentary_search_list': commentary_search_list, + 'comment_recent_list': comment_recent_list, 'commentary_recent_list': commentary_recent_list } return render(request, 'commentaries/commentaries.html', context) diff --git a/comments/models.py b/comments/models.py index 4d9ac2be8190806074d2078eeb11e6772a082cf2..4bc3d9b50c8ab429aaf281bf8bc10bff54c188be 100644 --- a/comments/models.py +++ b/comments/models.py @@ -248,6 +248,8 @@ class Comment(models.Model): if len(self.comment_text) > 30: text_cut += '...' context['text_cut'] = text_cut + context['name'] = self.author.user.first_name + ' ' + self.author.user.last_name + header += '{{ name }}, ' if self.submission is not None: header += '<a href="/submission/{{ submission_id }}#comment_id{{ id }}"> \"{{ text_cut }}\"</a>' header += (' in submission on <a href="/submission/{{ submission_id }}" class="pubtitleli">' +