@task()
def enable_self_generated_certs(course_key):
 course_key = CourseKey.from_string(course_key)
 course = CourseOverview.get_from_id(course_key)
 is_enabled_for_course = CertificateGenerationCourseSetting.is_enabled_for_course(course_key)
 if (course.self_paced and (not is_enabled_for_course)):
  CertificateGenerationCourseSetting.set_enabled_for_course(course_key, True)

@ task ( ) def enable_self_generated_certs ( course_key ) : course_key = CourseKey . from_string ( course_key ) course = CourseOverview . get_from_id ( course_key ) is_enabled_for_course = CertificateGenerationCourseSetting . is_enabled_for_course ( course_key ) if ( course . self_paced and ( not is_enabled_for_course ) ) : CertificateGenerationCourseSetting . set_enabled_for_course ( course_key , True )
enable the self-generated certificates by default for self-paced courses .