[Answered ]-How to get a QuerySet with type of a ForeignKey attribute in Django

1👍

You can filter with:

Employee.objects.filter(prizedraw__isnull=False).distinct()

This will retrieve the Employees for which there is at least one related PrizeDraw record.

Leave a comment