forked from MarseyWorld/MarseyWorld
fdsfs
parent
a9cb97b482
commit
d666bfaa95
|
@ -512,14 +512,4 @@ class SaveRelationship(Base):
|
|||
id=Column(Integer, primary_key=true)
|
||||
user_id=Column(Integer, ForeignKey("users.id"))
|
||||
submission_id=Column(Integer, ForeignKey("submissions.id"))
|
||||
type=Column(Integer)
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_date(self):
|
||||
return time.strftime("%d %B %Y", time.gmtime(self.created_utc))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
||||
type=Column(Integer)
|
|
@ -559,9 +559,7 @@ class User(Base):
|
|||
@lazy
|
||||
def saved_idlist(self, page=1):
|
||||
|
||||
posts = g.db.query(Submission.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False,
|
||||
deleted_utc=0
|
||||
)
|
||||
posts = g.db.query(Submission.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, deleted_utc=0)
|
||||
|
||||
saved = [x[0] for x in g.db.query(SaveRelationship.submission_id).options(lazyload('*')).filter(SaveRelationship.user_id == self.id).all()]
|
||||
posts = posts.filter(Submission.id.in_(saved))
|
||||
|
@ -583,6 +581,7 @@ class User(Base):
|
|||
|
||||
return [x[0] for x in posts.offset(25 * (page - 1)).limit(26).all()]
|
||||
|
||||
@lazy
|
||||
def saved_comment_idlist(self, page=1):
|
||||
|
||||
comments = g.db.query(Comment.id).options(lazyload('*')).options(lazyload('*')).filter_by(is_banned=False, deleted_utc=0)
|
||||
|
|
Loading…
Reference in New Issue