Scenario
Lets say i have a model book with fields:
- id
- name
- author
- rating
(Keeping it simple :) )
Now lets say we have multiple rows of books in our db.
Question
How can I query the db to receive a array of Book objects who have the same author for instance?
array = Book.objects.filter(author='JK Rowling') --> returns a QuerySet
But i want an array of Book objects.
[{id:1, name:'HP 1', author: 'JK Rowling'},{id:2, name:'HP 2', author: 'JK Rowling'},{id:3, name:'HP 3', author: 'JK Rowling'}]