forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-07-29 16:05:57 +02:00
parent 71e269f5f6
commit 41fd1a2991
1 changed files with 3 additions and 2 deletions

View File

@ -5,7 +5,6 @@ from .mix_ins import *
from drama.helpers.base36 import *
from drama.helpers.lazy import lazy
from drama.__main__ import Base
from .votes import CommentVote
class CommentAux(Base):
@ -55,6 +54,8 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
post = relationship("Submission")
flags = relationship("CommentFlag", backref="comment")
votes = relationship("Vote", backref="comment")
author = relationship(
"User",
lazy="joined",
@ -214,7 +215,7 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
return data
def voted(self, v):
x = g.db.query(CommentVote).filter_by(comment_id=self.id, user_id=v.id).first()
x = self.votes.filter_by(user_id=v.id).first()
if x: return x.vote_type
else: return 0