Try this:
User.objects.filter(book__isnull=False).distinct()
I’m assuming there is only one foreign key from the Book
model to the User
model.
isnull
filters for all users which are in the which are linked to the Book
model.
distinct
ensures that each author only appears once in the results.