I have a very simple datamodel with a one-to-many relationship between video and comments:
class Video(models.Model):
url = models.URLField(unique=True)
.....
class Comment(models.Model):
title = models.CharField(max_length=128)
video = models.ForeignKey('Video')
.....
I want to query for videos and grab the whole object graph (videos with all the comments). Looking at the SQL, I see it does two selects, one for the Videos and one for the Comments. How do I avoid that? I want to do a join and grab everything at once.
Is it possible to do this with Django?