class Planet(Satellite):
orbital = models.IntegerField()
orbits = models.ForeignKey(Star, related_name='planets')
def save(self):
self.orbits = self.star
super(Planet, self).save()
This works, although it seems really inelegant due to duplicating data
in Planet.orbits
I was thinking, alternatively, in Planet:
orbits = models.ForeignKey(System, related_name='planets')
def __init__(self, *args, **kwargs):
super(Planet, self).__init__(*args, **kwargs)
orbits = system
--~--~-~--~~~---~--~~
You received this me
I'm making some sort of galactic map with the following classes
defined in models.py:
class Star(models.Model):
name = models.CharField(max_length=200)
xcoord = models.FloatField()
ycoord = models.FloatField()
zcoord = models.FloatField()
def __unicode__(self):
return
3 matches
Mail list logo