我有以下模型:
class AModel(TranslatableModel):
......
other fields definitions
......
translations = TranslatedFields(
name=models.CharField(max_length=100, blank=False, default=''),
description=models.CharField(max_length=500, blank=True, null=True)
)
我有该模型的两个实例:“源”和“目标”。当我尝试将可翻译字段从源复制到目标时:
destination.name = source.name
出现异常:
NoTranslationError: Accessing a translated field requires that the instance has a translation loaded, or a valid translation in current language (en-us) loadable from the database
有没有办法处理呢?
我的配置是:
django-hvad==1.7.0
Django==1.8.8