Create a fully functional get_comments for SQL

Using proper sqlalchemy syntax instead of the emulated
mongo one.
This commit is contained in:
Elrond 2012-01-02 13:07:16 +01:00
parent ee4fb8125a
commit 02ede85826

View File

@ -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"