Django Book 翻译
菜单>:
TOC
返回
原文:
We can fix this easily by adding a method called ``__str__()`` to our ``Publisher`` object. A ``__str__()`` method tells Python how to display the string representation of an object. You can see this in action by adding a ``__str__()`` method to the three models:
翻译:
我们可以简单解决这个问题,只需要添加一个方法 ``__str__()`` 到 ``Publisher`` 对象。 ``__str__()`` 方法告诉Python要怎样把对象当作字符串来使用。 请看下面:
备注:
译者: