本文整理汇总了Python中tastypie.bundle.Bundle.data['staff_or_instructor']方法的典型用法代码示例。如果您正苦于以下问题:Python Bundle.data['staff_or_instructor']方法的具体用法?Python Bundle.data['staff_or_instructor']怎么用?Python Bundle.data['staff_or_instructor']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tastypie.bundle.Bundle
的用法示例。
在下文中一共展示了Bundle.data['staff_or_instructor']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _staff_or_instructor_delete_list
# 需要导入模块: from tastypie.bundle import Bundle [as 别名]
# 或者: from tastypie.bundle.Bundle import data['staff_or_instructor'] [as 别名]
def _staff_or_instructor_delete_list(self, request, **kwargs):
# ETAPA 1 - Desserialização e validação dos dados recebidos
# ---------------------------------------------------------
course_id = course_id_decoder(kwargs['pk'])
staff_or_instructor = kwargs['staff_or_instructor']
deserialized = self.deserialize(request, request.body,
format=request.META.get('CONTENT_TYPE', 'application/json'))
deserialized = self.alter_deserialized_detail_data(
request, deserialized)
bundle = Bundle(data=dict_strip_unicode_keys(deserialized),
request=request)
if 'user_resource_uri' in bundle.data:
user_resource_uri = bundle.data['user_resource_uri']
bundle.data['course_id'] = course_id
bundle.data['staff_or_instructor'] = kwargs['staff_or_instructor']
validation = CleanedDataFormValidation(form_class=CourseDeleteUserForm)
validation_errors = validation.is_valid(bundle)
if validation_errors:
raise ImmediateHttpResponse(response=self.error_response(
bundle.request, validation_errors))
# ETAPA 2 - Efetuando operações no EDX
# ------------------------------------
username = user_resource_uri.split('/')[-2:-1][0]
course_remove_user(course_id, username, staff_or_instructor)
return http.HttpNoContent()