@receiver(user_pre_delete)
def user_commit_pending(sender, instance, **kwargs):
 all_changes = Change.objects.last_changes(instance).filter(user=instance)
 user_translation_ids = all_changes.values_list('translation', flat=True).distinct()
 for translation in Translation.objects.filter(pk__in=user_translation_ids):
  try:
   last_author = translation.change_set.content()[0].author
  except IndexError:
   continue
  if (last_author == instance):
   translation.commit_pending(None)

@ receiver ( user_pre_delete ) def user_commit_pending ( sender , instance , ** kwargs ) : all_changes = Change . objects . last_changes ( instance ) . filter ( user = instance ) user_translation_ids = all_changes . values_list ( 'translation' , flat = True ) . distinct ( ) for translation in Translation . objects . filter ( pk__in = user_translation_ids ) : try : last_author = translation . change_set . content ( ) [ 0 ] . author except IndexError : continue if ( last_author == instance ) : translation . commit_pending ( None )
commit pending changes for user on account removal .