d
This commit is contained in:
parent
6eb6346f5a
commit
450ac450aa
4 changed files with 71 additions and 7 deletions
|
@ -2,7 +2,8 @@ import re
|
|||
from urllib.parse import urlencode, urlparse, parse_qs
|
||||
from flask import *
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship, deferred
|
||||
from sqlalchemy.orm import relationship, deferred, lazyload
|
||||
from files.classes.votes import CommentVote
|
||||
from files.helpers.lazy import lazy
|
||||
from files.helpers.const import SLURS
|
||||
from files.__main__ import Base
|
||||
|
@ -61,6 +62,11 @@ class Comment(Base):
|
|||
|
||||
return f"<Comment(id={self.id})>"
|
||||
|
||||
def poll_voted(self, v):
|
||||
vote = g.db.query(CommentVote).options(lazyload('*')).filter_by(user_id=v.id, comment_id=self.id).first()
|
||||
if vote: return vote.vote_type
|
||||
else: return None
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue