Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id C408CE00C35; Fri, 28 Aug 2015 05:59: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: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [134.134.136.65 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id C9B8CE00C0A for ; Fri, 28 Aug 2015 05:59:26 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 28 Aug 2015 05:59:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,424,1437462000"; d="scan'208";a="757224944" Received: from mozel-mobl1.ger.corp.intel.com (HELO lp.ger.corp.intel.com) ([10.252.17.173]) by orsmga001.jf.intel.com with ESMTP; 28 Aug 2015 05:59:25 -0700 From: Elliot Smith To: toaster@yoctoproject.org Date: Fri, 28 Aug 2015 13:59:14 +0100 Message-Id: <1440766756-15076-5-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1440766756-15076-1-git-send-email-elliot.smith@intel.com> References: <1440766756-15076-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: Fri, 28 Aug 2015 12:59: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 6b1f9d4..8c8a4bb 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -2796,6 +2796,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.