Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id B82C2E00CD0; Wed, 2 Sep 2015 01:57:27 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.24 listed in list.dnswl.org] Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id CD8D3E006EA for ; Wed, 2 Sep 2015 01:57:20 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 02 Sep 2015 01:57:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,452,1437462000"; d="scan'208";a="796529224" Received: from gionescx-mobl1.ger.corp.intel.com (HELO lp.ger.corp.intel.com) ([10.252.26.81]) by fmsmga002.fm.intel.com with ESMTP; 02 Sep 2015 01:57:16 -0700 From: Elliot Smith To: toaster@yoctoproject.org Date: Wed, 2 Sep 2015 09:56:52 +0100 Message-Id: <1441184214-8074-5-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1441184214-8074-1-git-send-email-elliot.smith@intel.com> References: <1441184214-8074-1-git-send-email-elliot.smith@intel.com> Subject: [review-request][PATCH 4/6] toaster: Exclude default project unless it has builds X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2015 08:57:27 -0000 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 --- 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.