- Add translations for NL, DE and FR
- Remove translation strings in example and tests
- Add
TranslationModelForm
- Add support for Django==3.2
- Adjust imports to remove deprecation warnings with django==3.1.* #65
- Add per-record fallback feature #63
- Drop python 2, Django 1.11 and Django 2.0 support #56
- Add option for
i18n
model fields inheritance #51 - Fix patching managers of models inheriting from an abstract models #50
- Fix exception on nullable i18n field #49
- Add instruction to remove
virtual_fields=True
to migration guide, fixes #45 - Use
AppConfig
to compute path to app dir, fixes #46 - Do not copy empty fields into i18n field, fixes #47
- Removed
encoding
kwarg toopen()
insetup.py
to fix python 2.7 install.
- Added
long_description
tosetup.py
, no functional changes.
- Adopted black code style.
- Removed auto-adding indexes, as it was unpredictable. You must add the
GinIndex
manually like described in the documentation on performance. - Support dict for
required_languages
argument toTranslationField
, to allow more fine-grained mapping of field names to required languages. ActiveLanguageMixin
does not use the<field>_i18n
version of the field, but rather the virtual field with the current active language. This makes sure no fallback values are accidentally saved for another language.
- Hide original field with
ActiveLanguageMixin
. - Raise an
ValueError
on accessing translated fields on a model fetched with.defer('i18n')
. - do not accidentally add
i18n
to dict in Model.create - Improve handling of explicit PK's and expression rewriting code.
- Add help_text to virtual fields with language=None.
- Dropped support for Django 1.9 and 1.10.
- Used
ugettext_lazy
rather thanugettext
to fix admin header translation #32 - Removed default value
False
forField.editable
, to allow using the translated version of a field in aModelForm
.
- No annotations are made while ordering anymore, instead, expressions are passed onto the original
order_by()
method. - Any translated fields used in
Model.Meta.ordering
is transformed into the correct expression with django 2.0 and later (fixes #25). django.contrib.postgres.GinIndex
is added to thei18n
column if it's supported by the django version used (1.11 and later). It can be disabled with the settingMODELTRANS_CREATE_GIN
.- The migration generated from
./manage.py i18n_makemigrations <app>
used to move the data and add a GIN index. This is split into two commands:./manage.py i18n_makemigrations
and./manage.py i18n_make_indexes
. - Added support for `values(**expressions)`` with references to translated fields.
- Added support for translated values in
annotate()
- Ensure a dynamic mixed
MultilingualQuerySet
can be pickled. - Add basic support for
Func
inorder_by()
- Allow adding
MultilingualManager()
as a manager to objects without translations to allow lookups of translated content through those managers.
- Use proper alias in subqueries, fixes #23.
- Support lookups on and ordering by related translated fields (
.filter(category__name_nl='Vogels')
), fixes #13. - Use
KeyTextTransform()
rather thanRawSQL()
to access keys in theJSONField
. For Django 1.9 and 1.10 the Django 1.11 version is used.
- Check if
MODELTRANS_AVAILABLE_LANGUAGES
only contains strings. - Make sure
settings.LANGUAGE_CODE
is never returned fromconf.get_available_languages()
-
Cleaned up the settings used by django-modeltrans #19. This might be a breaking change, depending on your configuration.
AVAILABLE_LANGUAGES
is now renamed toMODELTRANS_AVAILABLE_LANGUAGES
and defaults to the language codes in the djangoLANGUAGES
setting.DEFAULT_LANGUAGE
is removed, instead, django-modeltrans uses the djangoLANGUAGE_CODE
setting.
-
Added per-language configurable fallback using the
MODELTRANS_FALLBACK
setting.
- Also fall back to
DEFAULT_LANGUAGE
if the value for a key in the translations dict is falsy.
- Removed registration in favor of adding the
TranslationField
to a model you need to translated. - Created documentation.
- Improve robustness of rewriting lookups in QuerySets
- Add the
gin
index in the data migration. - Added tests for the migration procedure.