aboutsummaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2014-03-24 21:32:08 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-28 13:44:26 +0000
commitd21b64bad8a6a5e23eab552868d555f6e004f4c7 (patch)
tree0b650b6e8ab182064043c59154acd3332223008d /lib/toaster/toastergui/views.py
parentcb26c4df04170143babd6c9fd60600bfb31486ed (diff)
downloadbitbake-d21b64bad8a6a5e23eab552868d555f6e004f4c7.tar.gz
toaster: insure _get_query returns distinct records
The '_get_query' can return duplicate records if a search term appears multiple times in the same row, so the queryset must be made distinct before returning. This commit also removes the initial special case for configvars in favor of this general solution. [YOCTO #6012] Signed-off-by: David Reyna <David.Reyna@windriver.com>
Diffstat (limited to 'lib/toaster/toastergui/views.py')
-rw-r--r--lib/toaster/toastergui/views.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index 4f31ddb4b..8f6e201ec 100644
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -192,7 +192,8 @@ def _get_queryset(model, queryset, filter_string, search_term, ordering_string):
else:
queryset = queryset.order_by(column)
- return queryset
+ # insure only distinct records (e.g. from multiple search hits) are returned
+ return queryset.distinct()
# shows the "all builds" page
def builds(request):
@@ -1060,10 +1061,8 @@ def configvars(request, build_id):
return _redirect_parameters( 'configvars', request.GET, mandatory_parameters, build_id = build_id)
queryset = Variable.objects.filter(build=build_id).exclude(variable_name__istartswith='B_').exclude(variable_name__istartswith='do_')
- queryset_with_search = _get_queryset(Variable, queryset, None, search_term, ordering_string).distinct().exclude(variable_value='',vhistory__file_name__isnull=True)
+ queryset_with_search = _get_queryset(Variable, queryset, None, search_term, ordering_string).exclude(variable_value='',vhistory__file_name__isnull=True)
queryset = _get_queryset(Variable, queryset, filter_string, search_term, ordering_string)
- # remove duplicate records from multiple search hits in the VariableHistory table
- queryset = queryset.distinct()
# remove records where the value is empty AND there are no history files
queryset = queryset.exclude(variable_value='',vhistory__file_name__isnull=True)