Django Book 翻译
菜单>:
TOC
返回
原文:
* Were using ``model.__name__.lower()`` in determining the template name. Every Python class has a ``__name__`` attribute that returns the class name. This feature is useful at times like this, when we dont know the type of class until runtime. For example, the ``BlogEntry`` classs ``__name__`` is the string ``'BlogEntry'`` .
翻译:
* 我们使用 ``model.__name__.lower()`` 来决定模板的名字。每个Python的类都有一个 ``__name__`` 属性返回类名。这特性在当我们直到运行时刻才知道对象类型的这种情况下很有用。比如, ``BlogEntry`` 类的 ``__name__`` 就是字符串 ``'BlogEntry'`` 。
备注:
译者: