Django Book 翻译
菜单>:
TOC
返回
原文:
Another common need is to filter down the objects given in a list page by some key in the URL. Earlier we hard-coded the publishers name in the URLconf, but what if we wanted to write a view that displayed all the books by some arbitrary publisher? We can wrap the ``object_list`` generic view to avoid writing a lot of code by hand. As usual, well start by writing a URLconf:
翻译:
另一个常见的需求是按URL里的关键字来过滤数据对象。在前面我们用在URL配置中 硬编码出版商名称的方法来做这个,但是我们想要用一个视图就能显示某个出版商 的所有书籍该怎么办呢?我们可以通过对 ``object_list`` 通用视图进行包装来避免 写一大堆的手工代码。按惯例,我们先从写URL配置开始:
备注:
译者: