admin: fixed the forum panel

This commit is contained in:
Darks 2020-09-24 00:22:20 +02:00
parent ed5367d46d
commit e265e003b9
Signed by: Darks
GPG Key ID: 7515644268BE1433
2 changed files with 3 additions and 2 deletions

View File

@ -38,7 +38,8 @@ class Forum(db.Model):
def post_count(self):
"""Number of posts in every topic of the forum, without subforums."""
return sum(len(t.thread.comments) for t in self.topics)
# TODO: optimize this with real ORM
return sum(t.thread.comments.count() for t in self.topics)
def __repr__(self):
return f'<Forum: {self.name}>'

View File

@ -7,7 +7,7 @@
<td style='padding-left: {{ 6+24*level }}px'>
<a href='/forum{{ f.url }}'>{{ f.name }}</a>
</td>
<td>{{ f.topics | length }}</td>
<td>{{ f.topics.count() }}</td>
<td>{{ f.post_count() }}</td>
</tr>