Mark wrote:
Hi,

Say I have these simple models:

class Musician(models.Model):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)

class Album(models.Model):
    artist = models.ForeignKey(Musician)
    name = models.CharField(max_length=100)

I think the first thing you need to do is decide if there is going to be more than one Musician object. and more than one Album object. Presently you are giving all musicians the same first_name and last_name. I suggest you look up the documentation for the special method __init__()

Then you need to realize that assigning new attributes to an instance object needs to be done inside an instance method, either __init__() or some other method with a self parameter.


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to