Django Book 翻译
菜单>:
TOC
返回
原文:
By default, Django adds a ``Manager`` with the name ``objects`` to every Django model class. However, if you want to use ``objects`` as a field name, or if you want to use a name other than ``objects`` for the ``Manager`` , you can rename it on a per-model basis. To rename the ``Manager`` for a given class, define a class attribute of type ``models.Manager()`` on that model, for example:
翻译:
Django默认会给每个模型添加一个叫做 ``objects`` 的 ``Manager`` 。如果你想把一个字段命名为 ``objects`` 的话,或者你不想把 ``Manager`` 命名为 ``objects`` ,你可以在每个模型里做修改。在模型里面定一个 ``models.Manager()`` 类型的类属性,就可以修改这个类的 ``Manager`` 的名字了,例如:
备注:
译者: