Re: Re: ManyToManyField Usage

2006-07-23 Thread Minglei Wang
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

Re: Re: ManyToManyField Usage

2006-07-23 Thread Minglei Wang
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 

ManyToManyField Usage

2006-07-23 Thread Minglei Wang
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