'Prepare field lists and a list of the fields that used through models
in the old state so dependencies can be made from the through model
deletion to the field that uses it.'

def _prepare_field_lists(self):

    self.kept_model_keys = set(self.old_model_keys).intersection(self.new_model_keys)
    self.kept_proxy_keys = set(self.old_proxy_keys).intersection(self.new_proxy_keys)
    self.kept_unmanaged_keys = set(self.old_unmanaged_keys).intersection(self.new_unmanaged_keys)
    self.through_users = {}
    self.old_field_keys = set()
    self.new_field_keys = set()
    for (app_label, model_name) in sorted(self.kept_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)]
        new_model_state = self.to_state.models[(app_label, model_name)]
        self.old_field_keys.update(((app_label, model_name, x) for (x, y) in old_model_state.fields))
        self.new_field_keys.update(((app_label, model_name, x) for (x, y) in new_model_state.fields))
