I have the following code:
class Book(models.Model):
author = models.ForeignKey(Author)
def get_books_for_same_author(self):
return Book.objects.filter(author = self.author)
When calling get_books_for_same_author, my common sense tells me that 2 DB queries are issued - one to get self.author and another for getting the books for this author.
Am I right? If so, is there a way to get the same results with only one query?