forked from rDrama/rDrama
remove all joinedload bullshit I added
parent
82821a16c2
commit
c8d5eb0f57
|
@ -1,6 +1,5 @@
|
||||||
from files.classes import *
|
from files.classes import *
|
||||||
from flask import g
|
from flask import g
|
||||||
from sqlalchemy.orm import joinedload, undefer
|
|
||||||
|
|
||||||
def get_id(username, v=None, graceful=False):
|
def get_id(username, v=None, graceful=False):
|
||||||
|
|
||||||
|
@ -41,16 +40,6 @@ def get_user(username, v=None, graceful=False, rendered=False):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if rendered:
|
|
||||||
user = user.options(
|
|
||||||
undefer('reserved'),
|
|
||||||
undefer('profilecss'),
|
|
||||||
undefer('bio'),
|
|
||||||
undefer('friends_html'),
|
|
||||||
undefer('enemies_html'),
|
|
||||||
joinedload(User.badges)
|
|
||||||
)
|
|
||||||
|
|
||||||
user = user.one_or_none()
|
user = user.one_or_none()
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
|
@ -160,17 +149,6 @@ def get_post(i, v=None, graceful=False, rendered=False, entered=False):
|
||||||
isouter=True
|
isouter=True
|
||||||
)
|
)
|
||||||
|
|
||||||
if rendered:
|
|
||||||
post = post.options(
|
|
||||||
joinedload(Submission.flags),
|
|
||||||
joinedload(Submission.awards),
|
|
||||||
joinedload(Submission.author),
|
|
||||||
joinedload(Submission.options).joinedload(SubmissionOption.votes)
|
|
||||||
)
|
|
||||||
|
|
||||||
if v and entered:
|
|
||||||
post = post.options(joinedload(Submission.comments))
|
|
||||||
|
|
||||||
post=post.one_or_none()
|
post=post.one_or_none()
|
||||||
|
|
||||||
if not post:
|
if not post:
|
||||||
|
@ -221,10 +199,6 @@ def get_posts(pids, v=None):
|
||||||
blocked,
|
blocked,
|
||||||
blocked.c.user_id == Submission.author_id,
|
blocked.c.user_id == Submission.author_id,
|
||||||
isouter=True
|
isouter=True
|
||||||
).options(joinedload(Submission.flags),
|
|
||||||
joinedload(Submission.awards),
|
|
||||||
joinedload(Submission.author),
|
|
||||||
joinedload(Submission.options).joinedload(SubmissionOption.votes)
|
|
||||||
).all()
|
).all()
|
||||||
|
|
||||||
output = [p[0] for p in query]
|
output = [p[0] for p in query]
|
||||||
|
@ -306,11 +280,6 @@ def get_comments(cids, v=None, load_parent=False):
|
||||||
blocked,
|
blocked,
|
||||||
blocked.c.user_id == Comment.author_id,
|
blocked.c.user_id == Comment.author_id,
|
||||||
isouter=True
|
isouter=True
|
||||||
).options(
|
|
||||||
joinedload(Comment.post),
|
|
||||||
joinedload(Comment.flags),
|
|
||||||
joinedload(Comment.awards),
|
|
||||||
joinedload(Comment.options).joinedload(CommentOption.votes)
|
|
||||||
).all()
|
).all()
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
|
|
|
@ -47,9 +47,7 @@ def option_votes(option_id, v):
|
||||||
|
|
||||||
if not option: abort(404)
|
if not option: abort(404)
|
||||||
|
|
||||||
ups = g.db.query(SubmissionOptionVote).filter_by(option_id=option_id).options(
|
ups = g.db.query(SubmissionOptionVote).filter_by(option_id=option_id).all()
|
||||||
joinedload(SubmissionOptionVote.user)
|
|
||||||
).all()
|
|
||||||
|
|
||||||
return render_template("poll_votes.html",
|
return render_template("poll_votes.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -99,9 +97,7 @@ def option_votes_comment(option_id, v):
|
||||||
|
|
||||||
if not option: abort(404)
|
if not option: abort(404)
|
||||||
|
|
||||||
ups = g.db.query(CommentOptionVote).filter_by(option_id=option_id).options(
|
ups = g.db.query(CommentOptionVote).filter_by(option_id=option_id).all()
|
||||||
joinedload(CommentOptionVote.user)
|
|
||||||
).all()
|
|
||||||
|
|
||||||
return render_template("poll_votes.html",
|
return render_template("poll_votes.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
|
|
@ -169,13 +169,6 @@ def post_id(pid, anything=None, v=None, sub=None):
|
||||||
blocked,
|
blocked,
|
||||||
blocked.c.user_id == Comment.author_id,
|
blocked.c.user_id == Comment.author_id,
|
||||||
isouter=True
|
isouter=True
|
||||||
).options(
|
|
||||||
joinedload(Comment.child_comments),
|
|
||||||
joinedload(Comment.flags),
|
|
||||||
joinedload(Comment.awards),
|
|
||||||
joinedload(Comment.author),
|
|
||||||
joinedload(Comment.options).joinedload(CommentOption.votes)
|
|
||||||
)
|
|
||||||
|
|
||||||
output = []
|
output = []
|
||||||
for c in comments.all():
|
for c in comments.all():
|
||||||
|
|
Loading…
Reference in New Issue