def images_people(): if request.method == 'POST': img_id = request.args.get('imageId') p_id = request.args.get('personId') action = request.args.get('action') if action == 'add': result = Image.add_person(session, img_id, p_id) return jsonify(AjaxResult(True, 'Person added to image successfully', result.to_json()).to_json()) else: result = Image.remove_person(session, img_id, p_id) return AjaxResult(True, 'Person removed from image successfully', result.to_json()).to_json()