What is the best way to make queries on a manytomany table?
Given the models below, how can I get a list of all the songs a
particular artist has?
class Artist(models.Model):
name = models.CharField(max_length=128)
def __unicode__(self):
return u'%s' %(self.name)
class Album(models.Model):
title = models.CharField(max_length=128)
artists = models.ManyToManyField(Artist)
def __unicode__(self):
return u'%s' %(self.title)
class Song(models.Model):
title = models.CharField(max_length=128)
albums = models.ManyToManyField(Album)
def __unicode__(self):
return self.title
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---