All fields that are attached to the models.
The core design of django-parler is to attach descriptor fields to the shared model, which then proxies the get/set calls to the translated model.
TranslatedField objects are automatically added to the shared model,
but may be added explicitly as well. This also allows to set the
any_language configuration option.
It’s also useful for abstract models; add a
indicate that the derived model is expected to provide that translatable field.
Proxy field attached to a model.
The field is automatically added to the shared model. However, this can be assigned manually to be more explicit, or to pass the
any_language=Trueoption causes the attribute to always return a translated value, even when the current language and fallback are missing. This can be useful for “title” attributes for example.
from django.db import models from parler.models import TranslatableModel, TranslatedFieldsModel class MyModel(TranslatableModel): title = TranslatedField(any_language=True) # Add with any-fallback support slug = TranslatedField() # Optional, but explicitly mentioned class MyModelTranslation(TranslatedFieldsModel): # Manual model class: master = models.ForeignKey(MyModel, related_name='translations', null=True) title = models.CharField("Title", max_length=200) slug = models.SlugField("Slug")
Initialize self. See help(type(self)) for accurate signature.