diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templatetags/projecttags.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index 1455026754..15a1757b35 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |||
@@ -16,8 +16,9 @@ | |||
16 | # with this program; if not, write to the Free Software Foundation, Inc., | 16 | # with this program; if not, write to the Free Software Foundation, Inc., |
17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
18 | 18 | ||
19 | from datetime import datetime | 19 | from datetime import datetime, timedelta |
20 | from django import template | 20 | from django import template |
21 | from django.utils import timezone | ||
21 | 22 | ||
22 | register = template.Library() | 23 | register = template.Library() |
23 | 24 | ||
@@ -42,8 +43,14 @@ def query(qs, **kwargs): | |||
42 | 43 | ||
43 | @register.filter | 44 | @register.filter |
44 | def divide(value, arg): | 45 | def divide(value, arg): |
46 | if int(arg) == 0: | ||
47 | return -1 | ||
45 | return int(value) / int(arg) | 48 | return int(value) / int(arg) |
46 | 49 | ||
47 | @register.filter | 50 | @register.filter |
48 | def multiply(value, arg): | 51 | def multiply(value, arg): |
49 | return int(value) * int(arg) | 52 | return int(value) * int(arg) |
53 | |||
54 | @register.assignment_tag | ||
55 | def datecompute(delta, start = timezone.now()): | ||
56 | return start + timedelta(delta) | ||