diff --git a/forums/models.py b/forums/models.py index 7086fee7b07e4024231480ca25748d5339137bec..d94cc5edc7d4a87f3a198ca9073bde9a3bddf287 100644 --- a/forums/models.py +++ b/forums/models.py @@ -94,6 +94,14 @@ class Forum(models.Model): except: return None + @property + def posts_all(self): + """ + Return all posts in the hierarchy. + """ + posts_id_list = self.posts_hierarchy_id_list() + return Post.objects.filter(id__in=posts_id_list) + class Meeting(Forum): """ diff --git a/forums/templates/forums/forum_detail.html b/forums/templates/forums/forum_detail.html index b0e6f3eb085f9f6d6ab329810b2d07d0645e1fc6..95fbbf234468afe847181eaec8abaf79aecb0943 100644 --- a/forums/templates/forums/forum_detail.html +++ b/forums/templates/forums/forum_detail.html @@ -124,7 +124,7 @@ <div class="card-body collapse" id="recentPostsLinks"> <h3>(most recent first)</h3> <ul> - {% for post in forum.posts.reverse %} + {% for post in forum.posts_all.reverse %} <li> <a href="{{ post.get_absolute_url }}">{{ post.subject }}</a> posted by {{ post.posted_by.first_name }} {{ post.posted_by.last_name }} on {{ post.posted_on|date:"Y-m-d H:m" }} {% if post.parent and not post.motion %}