From b0585e6b0c8d4b9a7d2102e615fff0ef069e0f98 Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Tue, 12 Jul 2016 15:54:43 -0700 Subject: 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 Signed-off-by: bavery Signed-off-by: Richard Purdie --- .../toastergui/templatetags/field_values_filter.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py (limited to 'bitbake/lib/toaster/toastergui/templatetags/field_values_filter.py') 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 @@ +from django import template + +register = template.Library() + +def field_values(iterable, field): + """ + Convert an iterable of models into a list of strings, one for each model, + where the string for each model is the value of the field "field". + """ + objects = [] + + if field: + for item in iterable: + objects.append(getattr(item, field)) + + return objects + +register.filter('field_values', field_values) \ No newline at end of file -- cgit v1.2.3-54-g00ecf