@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_invalidation_view(request, course_id):
 course_key = CourseKey.from_string(course_id)
 try:
  certificate_invalidation_data = parse_request_data(request)
  certificate = validate_request_data_and_get_certificate(certificate_invalidation_data, course_key)
 except ValueError as error:
  return JsonResponse({'message': error.message}, status=400)
 if (request.method == 'POST'):
  try:
   certificate_invalidation = invalidate_certificate(request, certificate, certificate_invalidation_data)
  except ValueError as error:
   return JsonResponse({'message': error.message}, status=400)
  return JsonResponse(certificate_invalidation)
 elif (request.method == 'DELETE'):
  try:
   re_validate_certificate(request, course_key, certificate)
  except ValueError as error:
   return JsonResponse({'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_invalidation_view ( request , course_id ) : course_key = CourseKey . from_string ( course_id ) try : certificate_invalidation_data = parse_request_data ( request ) certificate = validate_request_data_and_get_certificate ( certificate_invalidation_data , course_key ) except ValueError as error : return JsonResponse ( { 'message' : error . message } , status = 400 ) if ( request . method == 'POST' ) : try : certificate_invalidation = invalidate_certificate ( request , certificate , certificate_invalidation_data ) except ValueError as error : return JsonResponse ( { 'message' : error . message } , status = 400 ) return JsonResponse ( certificate_invalidation ) elif ( request . method == 'DELETE' ) : try : re_validate_certificate ( request , course_key , certificate ) except ValueError as error : return JsonResponse ( { 'message' : error . message } , status = 400 ) return JsonResponse ( { } , status = 204 )
invalidate/re-validate students to/from certificate .