本文整理汇总了Python中models.Record.approve_request方法的典型用法代码示例。如果您正苦于以下问题:Python Record.approve_request方法的具体用法?Python Record.approve_request怎么用?Python Record.approve_request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Record
的用法示例。
在下文中一共展示了Record.approve_request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: approve_requests
# 需要导入模块: from models import Record [as 别名]
# 或者: from models.Record import approve_request [as 别名]
def approve_requests():
"""
Approve or reject the requests as specified by request_id.
1) Approved requests are mapped from a request_id to the approved value of the request.
2) Rejected requests are identified by a request_id only.
"""
processed = []
approved = json.loads((request.form['approved']))
for request_id in approved:
value = float(approved[request_id])
record_id = Record.approve_request(int(request_id), value)
processed.append(record_id)
rejected = request.form['rejected'].split(',')
for request_id in rejected:
if request_id:
record_id = Record.reject_request(request_id)
processed.append(record_id)
return jsonify(success=processed)