diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-07-12 15:54:43 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-19 08:56:51 +0100 |
commit | b0585e6b0c8d4b9a7d2102e615fff0ef069e0f98 (patch) | |
tree | 7f9db275e0727896d9dab0d0b6eff74c79da92e1 /bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py | |
parent | 844e1f9e1dff7f5dc1eb68dd75121a07576a7b0f (diff) | |
download | poky-b0585e6b0c8d4b9a7d2102e615fff0ef069e0f98.tar.gz |
bitbake: toaster: display Target targets in build dashboard
The build dashboard was showing the targets for the build in the page
heading and title as "Target object".
Add a filter which extracts the "target" from each Target object
as a string so that the heading and title display correctly.
Also sort the image file suffixes alphabetically.
[YOCTO #8556]
(Bitbake rev: 33a24992139e7dc05d14bbe1da60299b732945aa)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py b/bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py new file mode 100644 index 0000000000..5a73af797c --- /dev/null +++ b/bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py | |||
@@ -0,0 +1,18 @@ | |||
1 | from django import template | ||
2 | |||
3 | register = template.Library() | ||
4 | |||
5 | def field_values(iterable, field): | ||
6 | """ | ||
7 | Convert an iterable of models into a list of strings, one for each model, | ||
8 | where the string for each model is the value of the field "field". | ||
9 | """ | ||
10 | objects = [] | ||
11 | |||
12 | if field: | ||
13 | for item in iterable: | ||
14 | objects.append(getattr(item, field)) | ||
15 | |||
16 | return objects | ||
17 | |||
18 | register.filter('field_values', field_values) \ No newline at end of file | ||