I have a model called book and in that model there is a foreignkey field (called author) to the user model.
I need in one of my views to returm a list of all the authors(not all users, just users that appear in the book model(just the authors).
I don’t know why, but i’m having a hard time getting that.
Can any one please help me with this?
10x,
Erez
Try this:
I’m assuming there is only one foreign key from the
Bookmodel to theUsermodel.isnullfilters for all users which are in the which are linked to theBookmodel.distinctensures that each author only appears once in the results.