1👍
✅
As you have found, it is not possible to use the generic foreign key in filter()
. However, as all you want to do is exclude objects without a related object, you can filter on object_id
instead.
Notification.objects.filter(object_id__isnull=False)
Source:stackexchange.com