[Toaster] [review-request][PATCH 4/6] toaster: Exclude default project unless it has builds
Elliot Smith
elliot.smith at intel.com
Wed Sep 2 01:56:52 PDT 2015
Don't include the default "command line builds" project in
the projects view unless it has builds associated with it.
[YOCTO #7932]
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
bitbake/lib/toaster/toastergui/views.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 6c73eb4..4e8f69e 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)
--
Elliot Smith
Software Engineer
Intel OTC
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the toaster
mailing list