'Find all deleted models (managed and unmanaged) and make delete
operations for them as well as separate operations to delete any
foreign key or M2M relationships (these are optimized later, if
possible).
Also bring forward removal of any model options that refer to
collections of fields - the inverse of generate_created_models().'

def generate_deleted_models(self):

    new_keys = set(self.new_model_keys).union(self.new_unmanaged_keys)
    deleted_models = (set(self.old_model_keys) - new_keys)
    deleted_unmanaged_models = (set(self.old_unmanaged_keys) - new_keys)
    all_deleted_models = chain(sorted(deleted_models), sorted(deleted_unmanaged_models))
    for (app_label, model_name) in all_deleted_models:
        model_state = self.from_state.models[(app_label, model_name)]
        model = self.old_apps.get_model(app_label, model_name)
        if (not model._meta.managed):
            continue
        related_fields = {}
        for field in model._meta.local_fields:
            if field.remote_field:
                if field.remote_field.model:
                    related_fields[field.name] = field
                if (getattr(field.remote_field, 'through', None) and (not field.remote_field.through._meta.auto_created)):
                    related_fields[field.name] = field
        for field in model._meta.local_many_to_many:
            if field.remote_field.model:
                related_fields[field.name] = field
            if (getattr(field.remote_field, 'through', None) and (not field.remote_field.through._meta.auto_created)):
                related_fields[field.name] = field
        unique_together = model_state.options.pop('unique_together', None)
        index_together = model_state.options.pop('index_together', None)
        if unique_together:
            self.add_operation(app_label, operations.AlterUniqueTogether(name=model_name, unique_together=None))
        if index_together:
            self.add_operation(app_label, operations.AlterIndexTogether(name=model_name, index_together=None))
        for (name, field) in sorted(related_fields.items()):
            self.add_operation(app_label, operations.RemoveField(model_name=model_name, name=name))
        dependencies = []
        for related_object in model._meta.related_objects:
            related_object_app_label = related_object.related_model._meta.app_label
            object_name = related_object.related_model._meta.object_name
            field_name = related_object.field.name
            dependencies.append((related_object_app_label, object_name, field_name, False))
            if (not related_object.many_to_many):
                dependencies.append((related_object_app_label, object_name, field_name, 'alter'))
        for (name, field) in sorted(related_fields.items()):
            dependencies.append((app_label, model_name, name, False))
        through_user = self.through_users.get((app_label, model_state.name_lower))
        if through_user:
            dependencies.append((through_user[0], through_user[1], through_user[2], False))
        self.add_operation(app_label, operations.DeleteModel(name=model_state.name), dependencies=list(set(dependencies)))
