'Through model map generation.'

def _generate_through_model_map(self):

    for (app_label, model_name) in sorted(self.old_model_keys):
        old_model_name = self.renamed_models.get((app_label, model_name), model_name)
        old_model_state = self.from_state.models[(app_label, old_model_name)]
        for (field_name, field) in old_model_state.fields:
            old_field = self.old_apps.get_model(app_label, old_model_name)._meta.get_field(field_name)
            if (hasattr(old_field, 'remote_field') and getattr(old_field.remote_field, 'through', None) and (not old_field.remote_field.through._meta.auto_created)):
                through_key = (old_field.remote_field.through._meta.app_label, old_field.remote_field.through._meta.model_name)
                self.through_users[through_key] = (app_label, old_model_name, field_name)
