aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mediagoblin/db/sql/models.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mediagoblin/db/sql/models.py b/mediagoblin/db/sql/models.py
index 507efe62..d5573a56 100644
--- a/mediagoblin/db/sql/models.py
+++ b/mediagoblin/db/sql/models.py
@@ -109,6 +109,13 @@ class MediaEntry(Base, MediaEntryMixin):
# attachment_files
# fail_error
+ def get_comments(self, ascending=False):
+ order_col = MediaComment.created
+ if not ascending:
+ order_col = desc(order_col)
+ return MediaComment.query.filter_by(
+ media_entry=self.id).order_by(order_col)
+
class MediaFile(Base):
__tablename__ = "mediafiles"