I notice that the second param is queryset, which is presumably returns the objects that have been deleted. However, this can only work if the queryset is generated before the objects are deleted. Should this be made clear in the documentation?
I am currently refactoring the django-import-export implementation, and have hit this issue. It worked previously because we had a queryset which retained the objects before deletion.
We are processing objects line by line, and deleting if required, like this (pseudo code):
for obj in queryset:
if self.for_delete(obj):
obj.delete()
LogEntry.objects.log_actions(
self.user.pk,
queryset,
DELETION
)
The issue we have is that
We can’t know which objects will be deleted until the qs is iterated.
We can’t call log_actions() with a ‘deletion’ queryset because the objects will no longer exist.
It worked prior to v5 because we kept a reference to the queryset and could iterate over each result of the import and determine whether it was a create, update or delete.
If you look at the sources in django.contrib.admin.models, it appears that the only real requirement is that it be an iterable. I don’t see anything giving me any indication that it requires an actual queryset.