-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into UPDATE_prevent_using_i18n_virt_field_as_fo…
…rm_field
- Loading branch information
Showing
7 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Working with models recipes. | ||
============================ | ||
|
||
Inheritance of translation models. | ||
---------------------------------- | ||
|
||
In case when you are working with models Inheritance and you want to change | ||
behavior of TranslationField declared in parent model, you should use | ||
`i18n_field_params` attribute and declare there parameters | ||
for child model field. | ||
|
||
Example of use: :: | ||
|
||
class ParentModel(models.Model): | ||
info = models.CharField(max_length=255) | ||
|
||
i18n = TranslationField(fields=("info", ), required_languages=("en",)) | ||
|
||
|
||
class ChildModel(ParentModel): | ||
child_info = models.CharField(max_length=255) | ||
|
||
i18n_field_params = { | ||
"fields": ("info", "child_info"), | ||
"required_languages": ("nl",) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters