How to make custom join query with Django ?
Posted
by xRobot
on Stack Overflow
See other posts from Stack Overflow
or by xRobot
Published on 2010-06-14T09:28:50Z
Indexed on
2010/06/14
9:32 UTC
Read the original article
Hit count: 429
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 ?
© Stack Overflow or respective owner