def reindex_questions_answers(sender, instance, **kw):
 if instance.id:
  answer_ids = instance.answers.all().values_list('id', flat=True)
  index_task.delay(AnswerMetricsMappingType, list(answer_ids))

def reindex_questions_answers ( sender , instance , ** kw ) : if instance . id : answer_ids = instance . answers . all ( ) . values_list ( 'id' , flat = True ) index_task . delay ( AnswerMetricsMappingType , list ( answer_ids ) )
when a question is saved .