summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-01-07 13:10:42 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-10 15:20:26 +0000
commit1b636173ca88e5ccca1992f9a12367a1189fa674 (patch)
tree0220e98e7b7a4027fb8c146bab9b3f81306fc9fe /bitbake/lib/toaster/toastergui/templatetags/projecttags.py
parent5482409a370552809de75150350defef04ac7144 (diff)
downloadpoky-1b636173ca88e5ccca1992f9a12367a1189fa674.tar.gz
bitbake: toaster: Toaster GUI, generic search, filter and order
This patch implements table searching, filtering and ordering, in a generic mode reusable for all tables. The search operates list of fields defined in the corresponding class for each model, search_allowed_fields. The search expression and filters are sent through GET requests using a QuerySet-like input. The inputs are filtered and validated before usage to prevent inadvertent or malicious use. Filters and table headers are defined in the views for each table, and rendered by generic code which is easily modified for various tables. The Build table and Configuration table are implemented using this framework as an example of how it should be used. [YOCTO #4249] [YOCTO #4254] [YOCTO #4255] [YOCTO #4256] [YOCTO #4257] [YOCTO #4259] [YOCTO #4260] (Bitbake rev: 2ca15117e4bbda38cda07511d0ff317273f91528) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py')
-rw-r--r--bitbake/lib/toaster/toastergui/templatetags/projecttags.py9
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
19from datetime import datetime 19from datetime import datetime, timedelta
20from django import template 20from django import template
21from django.utils import timezone
21 22
22register = template.Library() 23register = template.Library()
23 24
@@ -42,8 +43,14 @@ def query(qs, **kwargs):
42 43
43@register.filter 44@register.filter
44def divide(value, arg): 45def 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
48def multiply(value, arg): 51def multiply(value, arg):
49 return int(value) * int(arg) 52 return int(value) * int(arg)
53
54@register.assignment_tag
55def datecompute(delta, start = timezone.now()):
56 return start + timedelta(delta)