sfd
This commit is contained in:
parent
29507d19bb
commit
87b2ccbb52
5 changed files with 7 additions and 14 deletions
|
@ -11,6 +11,7 @@ from files.helpers.const import AUTOPOLLER_ID, AUTOBETTER_ID, censor_slurs, TROL
|
|||
from files.helpers.lazy import lazy
|
||||
from .flags import Flag
|
||||
from .comment import Comment
|
||||
from .award import AwardRelationship
|
||||
from flask import g
|
||||
|
||||
site = environ.get("DOMAIN").strip()
|
||||
|
@ -56,7 +57,7 @@ class Submission(Base):
|
|||
author = relationship("User", primaryjoin="Submission.author_id==User.id")
|
||||
oauth_app = relationship("OauthApp", viewonly=True)
|
||||
approved_by = relationship("User", uselist=False, primaryjoin="Submission.is_approved==User.id", viewonly=True)
|
||||
awards = relationship("AwardRelationship", viewonly=True)
|
||||
awards = relationship("AwardRelationship", viewonly=True, order_by=AwardRelationship.id.desc())
|
||||
reports = relationship("Flag", viewonly=True)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -74,7 +75,7 @@ class Submission(Base):
|
|||
@property
|
||||
@lazy
|
||||
def flags(self):
|
||||
return g.db.query(Flag).filter_by(post_id=self.id)
|
||||
return g.db.query(Flag).filter_by(post_id=self.id).order_by(Flag.id)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
|
@ -430,10 +431,6 @@ class Submission(Base):
|
|||
@lazy
|
||||
def active_flags(self): return self.flags.count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def ordered_flags(self): return self.flags.order_by(Flag.id).all()
|
||||
|
||||
|
||||
class SaveRelationship(Base):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue