@login_required
def edxnotes_visibility(request, course_id):
 course_key = CourseKey.from_string(course_id)
 course = get_course_with_access(request.user, 'load', course_key)
 field_data_cache = FieldDataCache([course], course_key, request.user)
 course_module = get_module_for_descriptor(request.user, request, course, field_data_cache, course_key, course=course)
 if (not is_feature_enabled(course)):
  raise Http404
 try:
  visibility = json.loads(request.body)['visibility']
  course_module.edxnotes_visibility = visibility
  course_module.save()
  return JsonResponse(status=200)
 except (ValueError, KeyError):
  log.warning("Could not decode request body as JSON and find a boolean visibility field: '%s'", request.body)
  return JsonResponseBadRequest()

@ login_required def edxnotes_visibility ( request , course_id ) : course_key = CourseKey . from_string ( course_id ) course = get_course_with_access ( request . user , 'load' , course_key ) field_data_cache = FieldDataCache ( [ course ] , course_key , request . user ) course_module = get_module_for_descriptor ( request . user , request , course , field_data_cache , course_key , course = course ) if ( not is_feature_enabled ( course ) ) : raise Http404 try : visibility = json . loads ( request . body ) [ 'visibility' ] course_module . edxnotes_visibility = visibility course_module . save ( ) return JsonResponse ( status = 200 ) except ( ValueError , KeyError ) : log . warning ( "Could not decode request body as JSON and find a boolean visibility field: '%s'" , request . body ) return JsonResponseBadRequest ( )
handle ajax call from "show notes" checkbox .