u._collect_sub_objects(instances_to_be_deleted)
for k in instances_to_be_deleted.ordered_keys():
    inst_dict = instances_to_be_deleted.data[k]
for i in list(inst_dict.values()):
    i.sender = None
i.save()
u.delete()
Nullable ForeignKeys and deleting a referenced model instance