Django Book 翻译
菜单>:
TOC
返回
原文:
Finally, the second paragraph of this template has an example of a *filter* , with which you can alter the display of a variable. In this example, ``{{ ship_date|date:"F j, Y" }}`` , were passing the ``ship_date`` variable to the ``date`` filter, giving the ``date`` filter the argument ``"F j, Y"`` . The ``date`` filter formats dates in a given format, as specified by that argument. Filters are attached using a pipe character (``|`` ), as a reference to Unix pipes.
翻译:
最后,这个模板的第二段落有一个 *filter* 过滤器的例子,它能让你用来转换变量的输出, 在这个例子中, ``{{ship_date|date:"F j, Y" }}`` 将变量 ``ship_date`` 用 ``date`` 过滤器来转换,转换的参数是 ``"F j, Y"`` . ``date`` 过滤器根据指定的参数进行格式输出。过滤器是用管道字符( ``|`` )来调用的,就和Unix管道一样.
备注:
译者: