def re_validate_certificate(request, course_key, generated_certificate):
 try:
  certificate_invalidation = CertificateInvalidation.objects.get(generated_certificate=generated_certificate)
 except ObjectDoesNotExist:
  raise ValueError(_('Certificate Invalidation does not exist, Please refresh the page and try again.'))
 else:
  certificate_invalidation.deactivate()
 student = certificate_invalidation.generated_certificate.user
 lms.djangoapps.instructor_task.api.generate_certificates_for_students(request, course_key, student_set='specific_student', specific_student_id=student.id)

def re_validate_certificate ( request , course_key , generated_certificate ) : try : certificate_invalidation = CertificateInvalidation . objects . get ( generated_certificate = generated_certificate ) except ObjectDoesNotExist : raise ValueError ( _ ( 'Certificate Invalidation does not exist, Please refresh the page and try again.' ) ) else : certificate_invalidation . deactivate ( ) student = certificate_invalidation . generated_certificate . user lms . djangoapps . instructor_task . api . generate_certificates_for_students ( request , course_key , student_set = 'specific_student' , specific_student_id = student . id )
remove certificate invalidation from db and start certificate generation task for this student .