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(
joinedload(Submission.flags),
joinedload(Submission.awards),
joinedload(Submission.author),
joinedload(Submission.options),
joinedload(Submission.options, SubmissionOption.votes)
joinedload(Submission.author).joinedload(User.badges),
joinedload(Submission.options).joinedload(SubmissionOption.votes)
)
post=post.one_or_none()
@ -204,9 +203,8 @@ def get_posts(pids, v=None):
isouter=True
).options(joinedload(Submission.flags),
joinedload(Submission.awards),
joinedload(Submission.author),
joinedload(Submission.options),
joinedload(Submission.options, SubmissionOption.votes)
joinedload(Submission.author).joinedload(User.badges),
joinedload(Submission.options).joinedload(SubmissionOption.votes)
).all()
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,
isouter=True
).options(
joinedload(Comment.child_comments),
joinedload(Comment.flags),
joinedload(Comment.awards),
joinedload(Comment.author),
joinedload(Comment.options),
joinedload(Comment.options, CommentOption.votes),
joinedload(Comment.child_comments)
joinedload(Comment.author).joinedload(User.badges),
joinedload(Comment.options).joinedload(CommentOption.votes)
)
output = []