How to make custom join query with Django ?
- by xRobot
I have these 2 models:
genre = (
('D', 'Dramatic'),
('T', 'Thriller'),
('L', 'Love'),
)
class Book(models.Model):
title = models.CharField(max_length=100)
genre = models.CharField(max_length=1, choices=genre)
class Author(models.Model):
user = models.ForeignKey(User, unique=True)
born = models.DateTimeField('born')
book = models.ForeignKey(Book)
I need to retrieve first_name and last_name of all authors of dramatic's books.
How can I do this in django ?