@receiver(post_delete, sender=Comment)
@receiver(post_save, sender=Comment)
def update_comment_flag(sender, instance, **kwargs):
 for unit in get_related_units(instance):
  unit.update_has_comment()
  if (instance.language is None):
   unit.translation.invalidate_cache('sourcecomments')

@ receiver ( post_delete , sender = Comment ) @ receiver ( post_save , sender = Comment ) def update_comment_flag ( sender , instance , ** kwargs ) : for unit in get_related_units ( instance ) : unit . update_has_comment ( ) if ( instance . language is None ) : unit . translation . invalidate_cache ( 'sourcecomments' )
update related unit comment flags .