SQLA migration: fix RemovedIn20Warnings

This commit is contained in:
justcool393 2023-02-18 22:19:10 -06:00 committed by Ben Rog-Wilhelm
parent 449e2557d0
commit ff09ba4209
4 changed files with 11 additions and 15 deletions

View file

@ -273,12 +273,12 @@ def update_filter_status(v):
return { 'result': f'Status of {new_status} is not permitted' }
if post_id:
p = g.db.query(Submission).get(post_id)
p = g.db.get(Submission, post_id)
old_status = p.filter_state
rows_updated = g.db.query(Submission).where(Submission.id == post_id) \
.update({Submission.filter_state: new_status})
elif comment_id:
c = g.db.query(Comment).get(comment_id)
c = g.db.get(Comment, comment_id)
old_status = c.filter_state
rows_updated = g.db.query(Comment).where(Comment.id == comment_id) \
.update({Comment.filter_state: new_status})
@ -732,13 +732,12 @@ def alt_votes_get(v):
@limiter.exempt
@admin_level_required(2)
def admin_link_accounts(v):
u1 = int(request.values.get("u1"))
u2 = int(request.values.get("u2"))
u1 = get_account(request.values.get("u1", ''))
u2 = get_account(request.values.get("u2", ''))
new_alt = Alt(
user1=u1,
user2=u2,
user1=u1.id,
user2=u2.id,
is_manual=True
)
@ -753,7 +752,7 @@ def admin_link_accounts(v):
g.db.add(ma)
g.db.commit()
return redirect(f"/admin/alt_votes?u1={g.db.query(User).get(u1).username}&u2={g.db.query(User).get(u2).username}")
return redirect(f"/admin/alt_votes?u1={u1.id}&u2={u2.id}")
@app.get("/admin/removed/posts")