Ok, ya que veo que no pusiste ni un solo modelo, dejame pensar todo por ti.
Código Python:
Ver originalclass Artist(models.Model):
first_name = models.CharField(max_length=150)
last_name = models.CharField(max_length=200)
birthday = models.DateField(blank=True, null=True)
def __unicode__(self):
return u'%s %s' % (self.first_name, self.last_name)
class Song(models.Model):
name = models.CharField(max_length=200)
artist = models.ForeignKey(Artist)
release_date = models.DateTimeField(default=datetime.datetime.now, blank=True, null=True)
description = models.TextField()
def __unicode__(self):
return u'%s %s' % (self.name, self.artist)
class PlayList(models.Model):
user = models.ForeignKey(User)
name = models.CharField(max_length=100)
creation_datetime = models.DateTimeField(default=datetime.datetime.now, blank=True, null=True)
def __unicode__(self):
return u'%s %s' % (self.user, self.name)
class Meta:
unique_together = ('user', 'name')
class PlayListInstance(models.Model):
play_list = models.ForeignKey(PlayList)
song = models.ForeignKey(Song)
index = models.IntegerField()
def __unicode__(self):
return u'%s %s %s' % (self.play_list, self.song, self.index)
class Meta:
unique_together = ('play_list', 'song', 'index')
Te recomiendo leer mas sobre modelos y mas que nada sobre diseño de base datos o al menos entender como trabajan las 4 relaciones básicas OneToOne, OneToMany, ManyToOne y ManyToMany.