本文整理汇总了Python中oc_platform.APIUtilities.failure方法的典型用法代码示例。如果您正苦于以下问题:Python APIUtilities.failure方法的具体用法?Python APIUtilities.failure怎么用?Python APIUtilities.failure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oc_platform.APIUtilities
的用法示例。
在下文中一共展示了APIUtilities.failure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: link_objective_to_standard
# 需要导入模块: from oc_platform import APIUtilities [as 别名]
# 或者: from oc_platform.APIUtilities import failure [as 别名]
def link_objective_to_standard(request):
objective_id = request.POST.get('objective_id', None)
standard_id = request.POST.get('standard_id', None)
remove_objective_id = request.POST.get('remove_objective_id', None)
standards_categories = TagCategory.objects.filter(title__in=['Standards', 'Objectives'])
try:
from curriculum.models import Objective
objective = Objective.objects.get(pk=objective_id)
previous_objective = Objective.objects.get(pk=remove_objective_id)
standard = Tag.objects.get(pk=standard_id, category__in=standards_categories)
except:
return APIUtilities._api_not_found()
if objective.parent:
return APIUtilities.failure({
'standard_id': objective.parent.id,
'standard_title': objective.parent.title
})
else:
previous_objective.parent = None
previous_objective.save()
objective.parent = standard
objective.save()
objective.parent = standard
objective.save()
return APIUtilities.success()