This won't work for if `params['query']` is set since it's not a queryset. It should be:

```python
pks = []
for obj in objects:
    if has_orphaned_field(obj):
        # log..
    else:
        pks.append(obj.pk)
objects = self.model.objects.filter(pk__in=pks)
```