messing with relationships

master
Aevann1 2022-07-03 06:27:48 +02:00
parent 367348c8b2
commit 91951ed142
2 changed files with 7 additions and 10 deletions

View File

@ -147,9 +147,8 @@ def get_post(i, v=None, graceful=False, rendered=False):
posts = post.options( posts = post.options(
joinedload(Submission.flags), joinedload(Submission.flags),
joinedload(Submission.awards), joinedload(Submission.awards),
joinedload(Submission.author), joinedload(Submission.author).joinedload(User.badges),
joinedload(Submission.options), joinedload(Submission.options).joinedload(SubmissionOption.votes)
joinedload(Submission.options, SubmissionOption.votes)
) )
post=post.one_or_none() post=post.one_or_none()
@ -204,9 +203,8 @@ def get_posts(pids, v=None):
isouter=True isouter=True
).options(joinedload(Submission.flags), ).options(joinedload(Submission.flags),
joinedload(Submission.awards), joinedload(Submission.awards),
joinedload(Submission.author), joinedload(Submission.author).joinedload(User.badges),
joinedload(Submission.options), joinedload(Submission.options).joinedload(SubmissionOption.votes)
joinedload(Submission.options, SubmissionOption.votes)
).all() ).all()
output = [p[0] for p in query] output = [p[0] for p in query]

View File

@ -171,12 +171,11 @@ def post_id(pid, anything=None, v=None, sub=None):
blocked.c.user_id == Comment.author_id, blocked.c.user_id == Comment.author_id,
isouter=True isouter=True
).options( ).options(
joinedload(Comment.child_comments),
joinedload(Comment.flags), joinedload(Comment.flags),
joinedload(Comment.awards), joinedload(Comment.awards),
joinedload(Comment.author), joinedload(Comment.author).joinedload(User.badges),
joinedload(Comment.options), joinedload(Comment.options).joinedload(CommentOption.votes)
joinedload(Comment.options, CommentOption.votes),
joinedload(Comment.child_comments)
) )
output = [] output = []