@transaction.non_atomic_requests
@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_global_staff
@require_http_methods(['POST', 'DELETE'])
def certificate_exception_view(request, course_id):
 course_key = CourseKey.from_string(course_id)
 try:
  (certificate_exception, student) = parse_request_data_and_get_user(request, course_key)
 except ValueError as error:
  return JsonResponse({'success': False, 'message': error.message}, status=400)
 if (request.method == 'POST'):
  try:
   exception = add_certificate_exception(course_key, student, certificate_exception)
  except ValueError as error:
   return JsonResponse({'success': False, 'message': error.message}, status=400)
  return JsonResponse(exception)
 elif (request.method == 'DELETE'):
  try:
   remove_certificate_exception(course_key, student)
  except ValueError as error:
   return JsonResponse({'success': False, 'message': error.message}, status=400)
  return JsonResponse({}, status=204)

@ transaction . non_atomic_requests @ ensure_csrf_cookie @ cache_control ( no_cache = True , no_store = True , must_revalidate = True ) @ require_global_staff @ require_http_methods ( [ 'POST' , 'DELETE' ] ) def certificate_exception_view ( request , course_id ) : course_key = CourseKey . from_string ( course_id ) try : ( certificate_exception , student ) = parse_request_data_and_get_user ( request , course_key ) except ValueError as error : return JsonResponse ( { 'success' : False , 'message' : error . message } , status = 400 ) if ( request . method == 'POST' ) : try : exception = add_certificate_exception ( course_key , student , certificate_exception ) except ValueError as error : return JsonResponse ( { 'success' : False , 'message' : error . message } , status = 400 ) return JsonResponse ( exception ) elif ( request . method == 'DELETE' ) : try : remove_certificate_exception ( course_key , student ) except ValueError as error : return JsonResponse ( { 'success' : False , 'message' : error . message } , status = 400 ) return JsonResponse ( { } , status = 204 )
add/remove students to/from certificate white list .