Re: Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
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

Re: Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
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

Model Class Inheritance question

2009-10-09 Thread whiskeyjuvenile
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