From a5151155862f9420fa01dceaa0e2bed6a8da4d92 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 21 Jan 2019 11:03:52 +0800 Subject: [PATCH] 1 --- chapter2/mysite/myapp/templatetags/myapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapter2/mysite/myapp/templatetags/myapp.py b/chapter2/mysite/myapp/templatetags/myapp.py index bc8593e..eed2b7c 100644 --- a/chapter2/mysite/myapp/templatetags/myapp.py +++ b/chapter2/mysite/myapp/templatetags/myapp.py @@ -6,4 +6,4 @@ register = template.Library() @register.simple_tag def present(val1, val2): """获取两个数的百分比,取整 val1 / val2 """ - return int(val1 * 100 / val2) \ No newline at end of file + return int(int(val1) * 100 / int(val2)) \ No newline at end of file