Create a fully functional get_comments for SQL
Using proper sqlalchemy syntax instead of the emulated mongo one.
This commit is contained in:
parent
ee4fb8125a
commit
02ede85826
@ -109,6 +109,13 @@ class MediaEntry(Base, MediaEntryMixin):
|
|||||||
# attachment_files
|
# attachment_files
|
||||||
# fail_error
|
# 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):
|
class MediaFile(Base):
|
||||||
__tablename__ = "mediafiles"
|
__tablename__ = "mediafiles"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user