def _section_student_admin(course, access):
    """ Provide data for the corresponding dashboard section """
    course_key = course.id
    is_small_course = _is_small_course(course_key)

    section_data = {
        'section_key':
        'student_admin',
        'section_display_name':
        _('Student Admin'),
        'access':
        access,
        'is_small_course':
        is_small_course,
        'get_student_enrollment_status_url':
        reverse('get_student_enrollment_status',
                kwargs={'course_id': six.text_type(course_key)}),
        'get_student_progress_url_url':
        reverse('get_student_progress_url',
                kwargs={'course_id': six.text_type(course_key)}),
        'enrollment_url':
        reverse('students_update_enrollment',
                kwargs={'course_id': six.text_type(course_key)}),
        'reset_student_attempts_url':
        reverse('reset_student_attempts',
                kwargs={'course_id': six.text_type(course_key)}),
        'reset_student_attempts_for_entrance_exam_url':
        reverse(
            'reset_student_attempts_for_entrance_exam',
            kwargs={'course_id': six.text_type(course_key)},
        ),
        'rescore_problem_url':
        reverse('rescore_problem',
                kwargs={'course_id': six.text_type(course_key)}),
        'override_problem_score_url':
        reverse('override_problem_score',
                kwargs={'course_id': six.text_type(course_key)}),
        'rescore_entrance_exam_url':
        reverse('rescore_entrance_exam',
                kwargs={'course_id': six.text_type(course_key)}),
        'student_can_skip_entrance_exam_url':
        reverse(
            'mark_student_can_skip_entrance_exam',
            kwargs={'course_id': six.text_type(course_key)},
        ),
        'list_instructor_tasks_url':
        reverse('list_instructor_tasks',
                kwargs={'course_id': six.text_type(course_key)}),
        'list_entrace_exam_instructor_tasks_url':
        reverse('list_entrance_exam_instructor_tasks',
                kwargs={'course_id': six.text_type(course_key)}),
        'spoc_gradebook_url':
        reverse('spoc_gradebook',
                kwargs={'course_id': six.text_type(course_key)}),
    }
    if is_writable_gradebook_enabled(
            course_key) and settings.WRITABLE_GRADEBOOK_URL:
        section_data['writable_gradebook_url'] = urljoin(
            settings.WRITABLE_GRADEBOOK_URL, '/' + text_type(course_key))
    return section_data
예제 #2
0
 def wrapped_function(self, request, **kwargs):
     """
     Wraps the given view function.
     """
     course_key = get_course_key(request, kwargs.get('course_id'))
     if not is_writable_gradebook_enabled(course_key):
         raise self.api_error(
             status_code=status.HTTP_403_FORBIDDEN,
             developer_message='The writable gradebook feature is not enabled for this course.',
             error_code='feature_not_enabled'
         )
     return view_func(self, request, **kwargs)
예제 #3
0
 def wrapped_function(self, request, **kwargs):
     """
     Wraps the given view function.
     """
     course_key = get_course_key(request, kwargs.get('course_id'))
     if not is_writable_gradebook_enabled(course_key):
         raise self.api_error(
             status_code=status.HTTP_403_FORBIDDEN,
             developer_message=
             'The writable gradebook feature is not enabled for this course.',
             error_code='feature_not_enabled')
     return view_func(self, request, **kwargs)
def _section_student_admin(course, access):
    """ Provide data for the corresponding dashboard section """
    course_key = course.id
    is_small_course = _is_small_course(course_key)

    section_data = {
        'section_key': 'student_admin',
        'section_display_name': _('Student Admin'),
        'access': access,
        'is_small_course': is_small_course,
        'get_student_enrollment_status_url': reverse(
            'get_student_enrollment_status',
            kwargs={'course_id': unicode(course_key)}
        ),
        'get_student_progress_url_url': reverse('get_student_progress_url', kwargs={'course_id': unicode(course_key)}),
        'enrollment_url': reverse('students_update_enrollment', kwargs={'course_id': unicode(course_key)}),
        'reset_student_attempts_url': reverse('reset_student_attempts', kwargs={'course_id': unicode(course_key)}),
        'reset_student_attempts_for_entrance_exam_url': reverse(
            'reset_student_attempts_for_entrance_exam',
            kwargs={'course_id': unicode(course_key)},
        ),
        'rescore_problem_url': reverse('rescore_problem', kwargs={'course_id': unicode(course_key)}),
        'override_problem_score_url': reverse('override_problem_score', kwargs={'course_id': unicode(course_key)}),
        'rescore_entrance_exam_url': reverse('rescore_entrance_exam', kwargs={'course_id': unicode(course_key)}),
        'student_can_skip_entrance_exam_url': reverse(
            'mark_student_can_skip_entrance_exam',
            kwargs={'course_id': unicode(course_key)},
        ),
        'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': unicode(course_key)}),
        'list_entrace_exam_instructor_tasks_url': reverse('list_entrance_exam_instructor_tasks',
                                                          kwargs={'course_id': unicode(course_key)}),
        'spoc_gradebook_url': reverse('spoc_gradebook', kwargs={'course_id': unicode(course_key)}),
    }
    if is_writable_gradebook_enabled(course_key) and settings.WRITABLE_GRADEBOOK_URL:
        section_data['writable_gradebook_url'] = urljoin(settings.WRITABLE_GRADEBOOK_URL, '/' + text_type(course_key))
    return section_data