Django Book 翻译
菜单>:
TOC
返回
原文:
Thats all the Python code we need to write. We still need to write a template, however. We could explicitly tell the ``object_list`` view which template to use by including a ``template_name`` key in the extra arguments dictionary, but in the absence of an explicit template Django will infer one from the objects name. In this case, the inferred template will be ``"books/publisher_list.html"`` the books part comes from the name of the app that defines the model, while the publisher bit is just the lowercased version of the models name.
翻译:
这就是所要编写的所有Python代码。当然,我们还需要编写一个模板。我们可以通过在额外参数 字典里包含 ``template_name`` 来清楚的告诉 ``object_list`` 视图使用哪个模板,但是 由于Django在不给定模板的时候会用对象的名称推导出一个。在这个例子中,这个推导出的模板名称 将是 ``"books/publisher_list.html"`` ,其中books部分是定义这个模型的app的名称, publisher部分是这个模型名称的小写。
备注:
译者: