Dear Martin,
a little bit disagree with your opnions. please see the code,
objalbum.save()
song, created = objalbum.song_set.get_or_create(name=name, album=objalbum)
That is to say, before get_or_create a song in album, the album is already
exist and has an id.
according to the definition of Fo
Hi martin,
thanx your help. i solved it. I change the model:
class Author(models.Model):
name = models.CharField(maxlength=200)
class Admin:
ordering = ['-name']
def __str__(self):
return self.name
class Album(models.Model):
name
Hi,
I created 2 objects as following:
class Author(models.Model):
name = models.CharField(maxlength=200)
class Admin:
ordering = ['-name']
def __str__(self):
return self.name
class Album(models.Model):
name = models.CharField(maxlength=200)
author = models.ManyToManyField(A
3 matches
Mail list logo