This commit is contained in:
Aevann1 2021-11-05 23:30:54 +02:00
parent 01a447f718
commit 198531c29d
5 changed files with 27 additions and 16 deletions

View file

@ -47,7 +47,6 @@ class Comment(Base):
ban_reason = Column(String)
post = relationship("Submission", viewonly=True)
flags = relationship("CommentFlag", lazy="dynamic", viewonly=True)
author = relationship("User", primaryjoin="User.id==Comment.author_id")
senttouser = relationship("User", primaryjoin="User.id==Comment.sentto", viewonly=True)
parent_comment = relationship("Comment", remote_side=[id], viewonly=True)
@ -65,6 +64,11 @@ class Comment(Base):
return f"<Comment(id={self.id})>"
@property
@lazy
def flags(self):
return g.db.query(CommentFlag).options(lazyload('*')).filter_by(comment_id=self.id)
@lazy
def poll_voted(self, v):
if v: