From 3b233fca49b4fe3db6e883b2ca7f5a2ee741c4ac Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Wed, 2 Sep 2015 17:25:10 -0700 Subject: bitbake: toaster: Exclude default project unless it has builds Don't include the default "command line builds" project in the projects view unless it has builds associated with it. [YOCTO #7932] (Bitbake rev: b37318057ccbfb3889d28fd593cc1602febf1ae9) Signed-off-by: Elliot Smith Signed-off-by: brian avery Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bitbake/lib') diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 6c73eb4c50..4e8f69e801 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -2804,6 +2804,14 @@ if True: queryset_all = Project.objects.all() + # annotate each project with its number of builds + queryset_all = queryset_all.annotate(num_builds=Count('build')) + + # exclude the command line builds project if it has no builds + q_default_with_builds = Q(is_default=True) & Q(num_builds__gt=0) + queryset_all = queryset_all.filter(Q(is_default=False) | + q_default_with_builds) + # boilerplate code that takes a request for an object type and returns a queryset # for that object type. copypasta for all needed table searches (filter_string, search_term, ordering_string) = _search_tuple(request, Project) -- cgit v1.2.3-54-g00ecf