Hi, I have some code like such...

def gen_planet_pos( max_dim ):
    return random.randint( 0, max_dim )


class Universe( models.Model ):
    width = models.IntegerField( default=100 )
    ...


class Planet( models.Model ):
    universe = models.ForeignKey( Universe )
    ...
    x_pos = models.IntegerField( default=gen_planet_pos( universe.width ) )


When I try to use this, I get "AttributeError: 'ForeignKey' object has no 
attribute 'width'".  That message appears when I try to even enter the 
shell.  I'm not sure what to do to prevent this error.  Your help is 
appreciated.

robbie 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/017356e1-c30d-4eb8-ab42-d366e91a862d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to