I'm trying to implement TG example model as learning in Django. http://www.turbogears.org/docs/TurboTunes/
http://sqlobject.org/SQLObject.html#relationships-between-classes-tables To create relationships between tables are used: ForeignKey: One-to-Many MultipleJoin: One-to-Many (with back references) RelatedJoin: Many-to-Many SingleJoin: One-to-One TG model: class Genre(SQLObject): name = StringCol(length=200) artists = RelatedJoin('Artist') class Artist(SQLObject): name = StringCol(length=200) genres = RelatedJoin('Genre') albums = MultipleJoin('Album') class Album(SQLObject): name = StringCol(length=200) artist = ForeignKey('Artist') songs = MultipleJoin('Song') class Song(SQLObject): name = StringCol(length=200) album = ForeignKey('Album') Django model _I think that it would be so_: class Genre(models.Model): name = models.CharField( maxlength=200, unique=True ) artists = models.ManyToManyField( 'Artist' ) class Admin: pass def __str__(self): return self.name class Artist(models.Model): name = models.CharField( maxlength=200, unique=True, db_index=True ) genres = models.ManyToManyField( Genre ) albums = models.ForeignKey( 'Album' ) class Admin: pass def __str__(self): return self.name class Album(models.Model): name = models.CharField( maxlength=200, db_index=True ) artist = models.ForeignKey( Artist ) songs = models.ForeignKey( 'Song' ) class Admin: pass def __str__(self): return self.name class Song(models.Model): name = models.CharField( maxlength=200, db_index=True ) album = models.ForeignKey( Album ) class Admin: pass def __str__(self): return self.name But, how create back references in One-to-Many relationship _models.ForeignKey_? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---