forked from rDrama/rDrama
fdfd
parent
51aea98f08
commit
c36fd9400b
|
@ -1,9 +1,10 @@
|
||||||
from flask import *
|
from flask import *
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship, deferred
|
from sqlalchemy.orm import relationship, deferred
|
||||||
from .mix_ins import *
|
|
||||||
from drama.helpers.lazy import lazy
|
from drama.helpers.lazy import lazy
|
||||||
from drama.__main__ import Base
|
from drama.__main__ import Base
|
||||||
|
from .mix_ins import *
|
||||||
|
from .flags import CommentFlag
|
||||||
|
|
||||||
class CommentAux(Base):
|
class CommentAux(Base):
|
||||||
|
|
||||||
|
@ -50,7 +51,7 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
|
||||||
oauth_app=relationship("OauthApp")
|
oauth_app=relationship("OauthApp")
|
||||||
|
|
||||||
post = relationship("Submission")
|
post = relationship("Submission")
|
||||||
flags = relationship("CommentFlag", backref="comment")
|
flags = relationship("CommentFlag", lazy="dynamic")
|
||||||
votes = relationship(
|
votes = relationship(
|
||||||
"CommentVote",
|
"CommentVote",
|
||||||
lazy="dynamic",
|
lazy="dynamic",
|
||||||
|
@ -288,14 +289,16 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def is_op(self):
|
def is_op(self): return self.author_id==self.post.author_id
|
||||||
return self.author_id==self.post.author_id
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def active_flags(self):
|
def active_flags(self): return len(self.flags)
|
||||||
return len(self.flags)
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def ordered_flags(self): return self.flags.order_by(CommentFlag.created_utc).all()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Notification(Base):
|
class Notification(Base):
|
||||||
|
|
|
@ -3,9 +3,9 @@ from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship, deferred
|
from sqlalchemy.orm import relationship, deferred
|
||||||
import re, random
|
import re, random
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from .mix_ins import *
|
|
||||||
from drama.helpers.lazy import lazy
|
from drama.helpers.lazy import lazy
|
||||||
from drama.__main__ import Base
|
from drama.__main__ import Base
|
||||||
|
from .mix_ins import *
|
||||||
from .flags import *
|
from .flags import *
|
||||||
|
|
||||||
class SubmissionAux(Base):
|
class SubmissionAux(Base):
|
||||||
|
|
Loading…
Reference in New Issue