Commits

Anonymous committed 9873ad6

Updated docs on referencing the source model

Comments (0)

Files changed (1)

 
     class SourceI18N(I18nModel):
         class Meta:
-            translatable_fields = ('title', 'body')
+            translation_fields = ('title', 'body')
 
 With the above setup, a new model is created that is named ``SourceI18N`` and it
 will contain the ``title``, ``body``, ``i18n_language`` and ``i18n_source``
 fields. The ``i18n_source`` is a foreign key to ``Source`` model.
 
+Other than adding the 'I18N' suffix to the translation model name, you can also
+use the ``source_model`` Meta option to reference the source model. For
+example::
+
+    class SourceTranslation(I18nModel):
+        class Meta:
+            source_model = Source
+            translation_fields = ('title', 'body')
+
+The ``source_model`` attribute can point to the class object directly, or it can
+use a string name of the class (ex: ``'Source'``) or, if the model is in a
+different app, you can also use the ``'app.Model'`` format commonly used in
+Django. The following are all equivalent::
+
+    class SourceTranslation(I18nModel):
+        class Meta:
+            source_model = Source
+
+
+    class SourceTranslation(I18nModel):
+        class Meta:
+            source_model = 'Source'
+
+
+    class SourceTranslation(I18nModel):
+        class Meta:
+            source_model = 'appname.Source'
+
 Creating translations
 =====================