DJANGO:模型翻译

时间:2018-10-13 16:31:40

标签: python django django-models

我正试图使我的应用程序支持多种语言,所以我最终选择了

from django.utils.translation import gettext_lazy as _
def __str__(self):
    return _('%(name)s') % {'name':self.name}

但是每次我尝试创建新的模式实例时,django都会引发错误。

TypeError at /en/admin/exchange/offer/
__str__ returned non-string (type __proxy__)

0 个答案:

没有答案
相关问题