fds
This commit is contained in:
parent
a8dfecf9ae
commit
191fe9cf19
1 changed files with 7 additions and 4 deletions
|
@ -150,13 +150,11 @@ def front_all(v):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#@cache.memoize(timeout=86400)
|
@cache.memoize(timeout=86400)
|
||||||
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', **kwargs):
|
def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='', **kwargs):
|
||||||
|
|
||||||
posts = g.db.query(Submission.id).options(lazyload('*'))
|
posts = g.db.query(Submission.id).options(lazyload('*'))
|
||||||
|
|
||||||
print(posts.all())
|
|
||||||
|
|
||||||
if 'rdrama' in request.host and sort == "hot":
|
if 'rdrama' in request.host and sort == "hot":
|
||||||
cutoff = int(time.time()) - 86400
|
cutoff = int(time.time()) - 86400
|
||||||
posts = posts.filter(Submission.created_utc >= cutoff)
|
posts = posts.filter(Submission.created_utc >= cutoff)
|
||||||
|
@ -172,7 +170,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
cutoff = now - 2592000
|
cutoff = now - 2592000
|
||||||
elif t == 'year':
|
elif t == 'year':
|
||||||
cutoff = now - 31536000
|
cutoff = now - 31536000
|
||||||
print(cutoff)
|
|
||||||
posts = posts.filter(Submission.created_utc >= cutoff)
|
posts = posts.filter(Submission.created_utc >= cutoff)
|
||||||
|
|
||||||
posts = posts.filter_by(is_banned=False, stickied=None, private=False, deleted_utc = 0)
|
posts = posts.filter_by(is_banned=False, stickied=None, private=False, deleted_utc = 0)
|
||||||
|
@ -201,6 +198,9 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
for word in filter_words:
|
for word in filter_words:
|
||||||
posts=posts.filter(not_(Submission.title.ilike(f'%{word}%')))
|
posts=posts.filter(not_(Submission.title.ilike(f'%{word}%')))
|
||||||
|
|
||||||
|
gt = kwargs.get("gt")
|
||||||
|
lt = kwargs.get("lt")
|
||||||
|
|
||||||
if not (v and v.shadowbanned):
|
if not (v and v.shadowbanned):
|
||||||
posts = posts.join(Submission.author).filter(User.shadowbanned == False)
|
posts = posts.join(Submission.author).filter(User.shadowbanned == False)
|
||||||
|
|
||||||
|
@ -295,6 +295,9 @@ def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs):
|
||||||
cutoff = now - 31536000
|
cutoff = now - 31536000
|
||||||
posts = posts.filter(Submission.created_utc >= cutoff)
|
posts = posts.filter(Submission.created_utc >= cutoff)
|
||||||
|
|
||||||
|
gt = kwargs.get("gt")
|
||||||
|
lt = kwargs.get("lt")
|
||||||
|
|
||||||
if sort == "new":
|
if sort == "new":
|
||||||
posts = posts.order_by(Submission.created_utc.desc())
|
posts = posts.order_by(Submission.created_utc.desc())
|
||||||
elif sort == "old":
|
elif sort == "old":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue