diff options
| -rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 8 |
1 files changed, 8 insertions, 0 deletions
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: | |||
| 2804 | 2804 | ||
| 2805 | queryset_all = Project.objects.all() | 2805 | queryset_all = Project.objects.all() |
| 2806 | 2806 | ||
| 2807 | # annotate each project with its number of builds | ||
| 2808 | queryset_all = queryset_all.annotate(num_builds=Count('build')) | ||
| 2809 | |||
| 2810 | # exclude the command line builds project if it has no builds | ||
| 2811 | q_default_with_builds = Q(is_default=True) & Q(num_builds__gt=0) | ||
| 2812 | queryset_all = queryset_all.filter(Q(is_default=False) | | ||
| 2813 | q_default_with_builds) | ||
| 2814 | |||
| 2807 | # boilerplate code that takes a request for an object type and returns a queryset | 2815 | # boilerplate code that takes a request for an object type and returns a queryset |
| 2808 | # for that object type. copypasta for all needed table searches | 2816 | # for that object type. copypasta for all needed table searches |
| 2809 | (filter_string, search_term, ordering_string) = _search_tuple(request, Project) | 2817 | (filter_string, search_term, ordering_string) = _search_tuple(request, Project) |
