# Create the table object
table = Table(_table_name, foreign_class.__table__.metadata,
Column(foreign_key_name, Integer, ForeignKey(foreign_class.id),
- primary_key=True, nullable=False),
+ primary_key=True, nullable=False,
+ info=dict(description="ID of the %s these texts relate to" % foreign_class.__singlename__)),
Column('local_language_id', Integer, ForeignKey(language_class.id),
- primary_key=True, nullable=False),
+ primary_key=True, nullable=False,
+ info=dict(description="Language these texts are in")),
)
Translations.__table__ = table
'foreign_id': synonym(foreign_key_name),
'local_language': relationship(language_class,
primaryjoin=table.c.local_language_id == language_class.id,
- innerjoin=True),
+ innerjoin=True,
+ lazy='joined'),
})
# Add full-table relations to the original class
setattr(foreign_class, name + '_map',
association_proxy(relation_name, name, creator=creator))
+ # Add to the list of translation classes
+ foreign_class.translation_classes.append(Translations)
+
# Done
return Translations