Django Book 翻译
菜单>:
TOC
返回
原文:
Were repeating ourselves in this code, and thats inelegant. At first, you may think to remove the redundancy by using the same view for both URLs, putting parentheses around the URL to capture it, and checking the URL within the view to determine the template, like so:
翻译:
我们在这代码里面做了重复的工作,不够简练。起初你可能会想,通过对两个URL都试用同样的视图,在URL中使用括号捕捉请求,然后在视图中检查并决定使用哪个模板来去除代码的冗余,就像这样:
备注:
译者: