开发者

Is it possible to change the model name in the django admin site?

I am 开发者_如何学Pythontranslating a django app and I would like to translate also the homepage of the django admin site.

On this page are listed the application names and the model class names. I would like to translate the model class name but I don't find how to give a user-friendly name for a model class.

Does anybody know how to do that?


Look at the Meta options verbose_name and verbose_name_plural, both of which are translatable.


You should use the ugettext_lazy util in the Meta of all your models

from django.db import models
from django.utils.translation import ugettext_lazy as _

class Book(models.Model):
    ...

    class Meta:
        verbose_name = _("My Book")
        verbose_name_plural = _("My Books")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜