摘要: django 模板的乘法,除法1人收藏此文章,收藏此文章发表于11个月前 , 已有141次阅读 共0个评论1人收藏此文章Note: The results are rounded to an integer before returning, so this may have marginal utility for many cases.So, in summary:to compute A*B: {% widthratio A 1 B %}to compute A/B: {% widthratio AB 1 %}And, since add is a filter and not a ta 阅读全文
posted @ 2011-12-31 00:36 SophiaTang 阅读(1025) 评论(0) 推荐(0) 编辑
摘要: 原文地址是:http://zeroandone.posterous.com/top-10-tips-to-a-new-django-developer1,不要将项目名称包含在引用代码里比如你创建了一个名为"project"的项目,包含一个名为"app"的应用,那么如下代码是不好的:Python代码fromproject.app.modelsimportAuthor缺点在于:应用和项目变成了紧耦合,无法将应用轻易变得可重用。如果将来要换一个项目名称,那你可有得受了。推荐的做法是:Python代码fromapp.modelsimportAuthor请注意,你 阅读全文
posted @ 2011-12-31 00:32 SophiaTang 阅读(444) 评论(0) 推荐(0) 编辑