本文整理汇总了Python中models.Feedback.selected_recommendation方法的典型用法代码示例。如果您正苦于以下问题:Python Feedback.selected_recommendation方法的具体用法?Python Feedback.selected_recommendation怎么用?Python Feedback.selected_recommendation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Feedback
的用法示例。
在下文中一共展示了Feedback.selected_recommendation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_feedback
# 需要导入模块: from models import Feedback [as 别名]
# 或者: from models.Feedback import selected_recommendation [as 别名]
def post_feedback(id):
project = Project.query.get_or_404(id)
form = FeedbackForm()
if form.validate():
issue = Document(form.summary.data, form.description.data)
feedback = Feedback()
feedback.project = project
feedback.id = Feedback.get_id_from_doc(issue, project=project)
existing_feedback = Feedback.query.get(feedback.id)
if existing_feedback:
feedback = existing_feedback
if form.selected_recommendation.data:
feedback.selected_recommendation = \
form.selected_recommendation.data
if form.confirmed_recommendation.data:
feedback.confirmed_recommendation = \
form.confirmed_recommendation.data
db.session.add(feedback)
db.session.commit()
return jsonify(result="success")
return jsonify(result="error", errors=form.errors), 400