def generate_certificates_for_students(request, course_key, student_set=None, specific_student_id=None):
 if student_set:
  task_type = 'generate_certificates_student_set'
  task_input = {'student_set': student_set}
  if (student_set == 'specific_student'):
   task_type = 'generate_certificates_certain_student'
   if (specific_student_id is None):
    raise SpecificStudentIdMissingError('Attempted to generate certificate for a single student, but no specific student id provided')
   task_input.update({'specific_student_id': specific_student_id})
 else:
  task_type = 'generate_certificates_all_student'
  task_input = {}
 task_class = generate_certificates
 task_key = ''
 instructor_task = submit_task(request, task_type, task_class, course_key, task_input, task_key)
 CertificateGenerationHistory.objects.create(course_id=course_key, generated_by=request.user, instructor_task=instructor_task, is_regeneration=False)
 return instructor_task

def generate_certificates_for_students ( request , course_key , student_set = None , specific_student_id = None ) : if student_set : task_type = 'generate_certificates_student_set' task_input = { 'student_set' : student_set } if ( student_set == 'specific_student' ) : task_type = 'generate_certificates_certain_student' if ( specific_student_id is None ) : raise SpecificStudentIdMissingError ( 'Attempted to generate certificate for a single student, but no specific student id provided' ) task_input . update ( { 'specific_student_id' : specific_student_id } ) else : task_type = 'generate_certificates_all_student' task_input = { } task_class = generate_certificates task_key = '' instructor_task = submit_task ( request , task_type , task_class , course_key , task_input , task_key ) CertificateGenerationHistory . objects . create ( course_id = course_key , generated_by = request . user , instructor_task = instructor_task , is_regeneration = False ) return instructor_task
submits a task to generate certificates for given students enrolled in the course .