当前位置: 首页>>代码示例>>Python>>正文


Python CourseGradingModel.delete_grader方法代码示例

本文整理汇总了Python中models.settings.course_grading.CourseGradingModel.delete_grader方法的典型用法代码示例。如果您正苦于以下问题:Python CourseGradingModel.delete_grader方法的具体用法?Python CourseGradingModel.delete_grader怎么用?Python CourseGradingModel.delete_grader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.settings.course_grading.CourseGradingModel的用法示例。


在下文中一共展示了CourseGradingModel.delete_grader方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: course_grader_updates

# 需要导入模块: from models.settings.course_grading import CourseGradingModel [as 别名]
# 或者: from models.settings.course_grading.CourseGradingModel import delete_grader [as 别名]
def course_grader_updates(request, org, course, name, grader_index=None):
    """
    Restful CRUD operations on course_info updates. This differs from
    get_course_settings by communicating purely through json (not rendering any
    html) and handles section level operations rather than whole page.

    org, course: Attributes of the Location for the item to edit
    """

    location = get_location_and_verify_access(request, org, course, name)

    if request.method == 'GET':
        # Cannot just do a get w/o knowing the course name :-(
        return JsonResponse(CourseGradingModel.fetch_grader(
                Location(location), grader_index
        ))
    elif request.method == "DELETE":
        # ??? Should this return anything? Perhaps success fail?
        CourseGradingModel.delete_grader(Location(location), grader_index)
        return JsonResponse()
    else:  # post or put, doesn't matter.
        return JsonResponse(CourseGradingModel.update_grader_from_json(
                Location(location),
                request.POST
        ))
开发者ID:NikolayStrekalov,项目名称:edx-platform,代码行数:27,代码来源:course.py

示例2: remove_entrance_exam_graders

# 需要导入模块: from models.settings.course_grading import CourseGradingModel [as 别名]
# 或者: from models.settings.course_grading.CourseGradingModel import delete_grader [as 别名]
def remove_entrance_exam_graders(course_key, user):
    """
    Removes existing entrance exam graders attached to the specified course
    Typically used when adding/removing an entrance exam.
    """
    grading_model = CourseGradingModel.fetch(course_key)
    graders = grading_model.graders
    for i, grader in enumerate(graders):
        if grader['type'] == GRADER_TYPES['ENTRANCE_EXAM']:
            CourseGradingModel.delete_grader(course_key, i, user)
开发者ID:Lektorium-LLC,项目名称:edx-platform,代码行数:12,代码来源:helpers.py

示例3: setUp

# 需要导入模块: from models.settings.course_grading import CourseGradingModel [as 别名]
# 或者: from models.settings.course_grading.CourseGradingModel import delete_grader [as 别名]
    def setUp(self):
        """Устанавливает грейдеры на 3 типа заданий и задает им веса"""
        super(GradingValTest, self).setUp()

        self.graders = CourseGradingModel.fetch(self.course.id).graders
        self.graders[0]['min_count'] = 5
        self.graders[1]['min_count'] = 3
        self.graders[0]['weight'] = 33.
        self.graders[1]['weight'] = 27.
        for g in self.graders:
            CourseGradingModel.update_grader_from_json(self.course.id, g, self.user)
        CourseGradingModel.delete_grader(self.course_key, 2, self.user)
开发者ID:zimka,项目名称:course_validator,代码行数:14,代码来源:tests.py

示例4: grading_handler

# 需要导入模块: from models.settings.course_grading import CourseGradingModel [as 别名]
# 或者: from models.settings.course_grading.CourseGradingModel import delete_grader [as 别名]
def grading_handler(request, tag=None, course_id=None, branch=None, version_guid=None, block=None, grader_index=None):
    """
    Course Grading policy configuration
    GET
        html: get the page
        json no grader_index: get the CourseGrading model (graceperiod, cutoffs, and graders)
        json w/ grader_index: get the specific grader
    PUT
        json no grader_index: update the Course through the CourseGrading model
        json w/ grader_index: create or update the specific grader (create if index out of range)
    """
    locator = BlockUsageLocator(course_id=course_id, branch=branch, version_guid=version_guid, usage_id=block)
    if not has_access(request.user, locator):
        raise PermissionDenied()

    if 'text/html' in request.META.get('HTTP_ACCEPT', '') and request.method == 'GET':
        course_old_location = loc_mapper().translate_locator_to_location(locator)
        course_module = modulestore().get_item(course_old_location)
        course_details = CourseGradingModel.fetch(locator)

        return render_to_response('settings_graders.html', {
            'context_course': course_module,
            'course_locator': locator,
            'course_details': json.dumps(course_details, cls=CourseSettingsEncoder),
            'grading_url': locator.url_reverse('/settings/grading/'),
        })
    elif 'application/json' in request.META.get('HTTP_ACCEPT', ''):
        if request.method == 'GET':
            if grader_index is None:
                return JsonResponse(
                    CourseGradingModel.fetch(locator),
                    # encoder serializes dates, old locations, and instances
                    encoder=CourseSettingsEncoder
                )
            else:
                return JsonResponse(CourseGradingModel.fetch_grader(locator, grader_index))
        elif request.method in ('POST', 'PUT'):  # post or put, doesn't matter.
            # None implies update the whole model (cutoffs, graceperiod, and graders) not a specific grader
            if grader_index is None:
                return JsonResponse(
                    CourseGradingModel.update_from_json(locator, request.json),
                    encoder=CourseSettingsEncoder
                )
            else:
                return JsonResponse(
                    CourseGradingModel.update_grader_from_json(locator, request.json)
                )
        elif request.method == "DELETE" and grader_index is not None:
            CourseGradingModel.delete_grader(locator, grader_index)
            return JsonResponse()
开发者ID:e-ucm,项目名称:edx-platform,代码行数:52,代码来源:course.py

示例5: grading_handler

# 需要导入模块: from models.settings.course_grading import CourseGradingModel [as 别名]
# 或者: from models.settings.course_grading.CourseGradingModel import delete_grader [as 别名]
def grading_handler(request, course_key_string, grader_index=None):
    """
    Course Grading policy configuration
    GET
        html: get the page
        json no grader_index: get the CourseGrading model (graceperiod, cutoffs, and graders)
        json w/ grader_index: get the specific grader
    PUT
        json no grader_index: update the Course through the CourseGrading model
        json w/ grader_index: create or update the specific grader (create if index out of range)
    """
    course_key = CourseKey.from_string(course_key_string)
    course_module = _get_course_module(course_key, request.user)

    if "text/html" in request.META.get("HTTP_ACCEPT", "") and request.method == "GET":
        course_details = CourseGradingModel.fetch(course_key)

        return render_to_response(
            "settings_graders.html",
            {
                "context_course": course_module,
                "course_locator": course_key,
                "course_details": json.dumps(course_details, cls=CourseSettingsEncoder),
                "grading_url": reverse_course_url("grading_handler", course_key),
            },
        )
    elif "application/json" in request.META.get("HTTP_ACCEPT", ""):
        if request.method == "GET":
            if grader_index is None:
                return JsonResponse(
                    CourseGradingModel.fetch(course_key),
                    # encoder serializes dates, old locations, and instances
                    encoder=CourseSettingsEncoder,
                )
            else:
                return JsonResponse(CourseGradingModel.fetch_grader(course_key, grader_index))
        elif request.method in ("POST", "PUT"):  # post or put, doesn't matter.
            # None implies update the whole model (cutoffs, graceperiod, and graders) not a specific grader
            if grader_index is None:
                return JsonResponse(
                    CourseGradingModel.update_from_json(course_key, request.json, request.user),
                    encoder=CourseSettingsEncoder,
                )
            else:
                return JsonResponse(CourseGradingModel.update_grader_from_json(course_key, request.json, request.user))
        elif request.method == "DELETE" and grader_index is not None:
            CourseGradingModel.delete_grader(course_key, grader_index, request.user)
            return JsonResponse()
开发者ID:hmcmooc,项目名称:muddx-platform,代码行数:50,代码来源:course.py


注:本文中的models.settings.course_grading.CourseGradingModel.delete_grader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。