@transaction.non_atomic_requests
@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_global_staff
@require_POST
def start_certificate_generation(request, course_id):
 course_key = CourseKey.from_string(course_id)
 task = lms.djangoapps.instructor_task.api.generate_certificates_for_students(request, course_key)
 message = _('Certificate generation task for all students of this course has been started. You can view the status of the generation task in the "Pending Tasks" section.')
 response_payload = {'message': message, 'task_id': task.task_id}
 return JsonResponse(response_payload)

@ transaction . non_atomic_requests @ ensure_csrf_cookie @ cache_control ( no_cache = True , no_store = True , must_revalidate = True ) @ require_global_staff @ require_POST def start_certificate_generation ( request , course_id ) : course_key = CourseKey . from_string ( course_id ) task = lms . djangoapps . instructor_task . api . generate_certificates_for_students ( request , course_key ) message = _ ( 'Certificate generation task for all students of this course has been started. You can view the status of the generation task in the "Pending Tasks" section.' ) response_payload = { 'message' : message , 'task_id' : task . task_id } return JsonResponse ( response_payload )
start generating certificates for all students enrolled in given course .