Django Book 翻译
菜单>:
TOC
返回
原文:
For example, consider the view function we wrote earlier, which displays the current date and time. If we wanted to change the URL for the application say, move it from ``/time/`` to ``/currenttime/`` we could make a quick change to the URLconf, without having to worry about the underlying implementation of the function. Similarly, if we wanted to change the view functionaltering its logic somehowwe could do that without affecting the URL to which the function is bound. Furthermore, if we wanted to expose the current-date functionality at *several* URLs, we could easily take care of that by editing the URLconf, without having to touch the view code.
翻译:
比方说,考虑有一个以前写的视图函数,这个函数显示当前日期和时间。如果我们想把它的URL 从原来的 ``/time/`` 改变到 ``/currenttime/`` ,我们只需要快速的修改一下URL配置即可, 不用担心这个函数的内部实现。同样的,如果我们想要修改这个函数的内部实现也不用担心会影响 到对应的URL。此外,如果我们想要输出这个函数到 *一些* URL, 我们只需要修改URL配置而不用 去改动视图的代码。
备注:
译者: