Browse Source

Set limit on query

Alec Nikolas Reiter 7 years ago
parent
commit
e185ce5664
1 changed files with 2 additions and 1 deletions
  1. 2 1
      flaskbb/forum/models.py

+ 2 - 1
flaskbb/forum/models.py

@@ -708,7 +708,8 @@ class Forum(db.Model, CRUDMixin):
             filter(Post.topic_id == Topic.id,
                    Topic.forum_id == self.id).\
             order_by(Post.date_created.desc()).\
-            first()
+            limit(1)\
+            .first()
 
         # Last post is none when there are no topics in the forum
         if last_post is not None: