[Answer]-ForeignKey Reverse relation query

1👍

Publisher.objects.filter(book__isnull=False).distinct()

This does a JOIN between the two tables and returns the rows where a book exists. distinct() is used to get rid of duplicate Publishers.

Leave a comment