Reputation:
so I know of the model.objects.all() but is there a way that i could get all of the items for a certain part of that database?
say I have a database of books and under that I have the author and illustrator fields that you can enter. what would I enter so that it returned a list of all the authors?
Upvotes: 0
Views: 647
Reputation: 21243
Write like
Books.objects.values('author').distinct()
You can check for distinct function in https://docs.djangoproject.com/en/1.3/ref/models/querysets/#distinct
Upvotes: 1