Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kvesteri committed Mar 25, 2015
1 parent d35fdfa commit e085bc0
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,27 @@ NOTICE: Calling make_translatable() for given mapper should happen only once per
make_translatable(sa.orm.mapper)


Secondly you need to define translatable models. You can achieve this by making you models extend Translatable mixin and defining __translated_columns__ class property.
Secondly you need to define translatable models. In the following example we add translatable Article model with two translatable properties (name and content).


::

class Article(Base, Translatable):
__translated_columns__ = [
sa.Column('name', sa.Unicode(255)),
sa.Column('content', sa.UnicodeText)
]
from sqlalchemy_i18n import Translatable, translation_base

id = sa.Column(sa.Integer, autoincrement=True, primary_key=True)

class Article(Base, Translatable):
id = sa.Column(sa.Integer, autoincrement=True, primary_key=True)
description = sa.Column(sa.UnicodeText)


class ArticleTranslation(translation_base(Article)):
__tablename__ = 'article_translation'

name = sa.Column(sa.Unicode(255))
content = sa.Column(sa.UnicodeText)




Resources
---------
Expand Down

0 comments on commit e085bc0

Please sign in to comment.