Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id CB523E007E1; Mon, 16 Nov 2015 15:40:20 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [74.125.82.48 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id AADB5E007E1 for ; Mon, 16 Nov 2015 15:40:17 -0800 (PST) Received: by wmvv187 with SMTP id v187so201928351wmv.1 for ; Mon, 16 Nov 2015 15:40:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZHiGikkui59sp8y5PBJFTQgxGzhwHQIjVM9fxy6260M=; b=EOf91G6IN/9FEj6l67AqpN3WZYu/owUn2c6E3OrGFumObVkwrgapCqUKWjgYj7ELjx x8PzZp8LoHqz9Oa8CCeAWktl0FyVdcMyJ64asVzJ6+oz1sK2Ay7n66AVg7pBtcX2y8j1 osBhywdr5SPV85EjhXPdOq63pPHxqke0EPhctZR9u2edJNiFXJQ4nmrSjAAYqA2pDZmj f+fD+gfBn2TEUcm45futGpX66x3vSVYOObWlpOtvaLe6zfhINAuAbFIh7XUBosexUXO2 lWFoKjSKs8ktJCk3YiirZHLdgfFWh2tWqTSoiPrbA6/KNewLNpMYzGuN1Qi5BxJdM6I/ EtdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZHiGikkui59sp8y5PBJFTQgxGzhwHQIjVM9fxy6260M=; b=YIoRdRE2qwQyALtOI6KpqBIUHDoGKBTDqr38q+5+CjKaRYQHoqZ84rQWjvPSmn2ws0 gJXSKy0WQEYgzPj+Cs4f4bLTL1GUL7PBoZYBv4sS+VgnJcRSU59BSb1IN2E1jkBDJgJx TbedjV6SY4dUv+NEB9r7gJevVUAhgCvCJde4WDHHgtgO3eOSDn2vgYjEGGE3Ebv/u7tc 7yngqwmDcwmQF+iTbBDn4bdPZeuJ59rHcHEyloPT5NaKLHD7b0Z8QZ+tpYz8hoD3jOZM vUNuS7ZwvwtWLZkq7acvcM6OsHFk26LTFoHi602iTrBLXFP5agx0wB91biR/cB5MeIJh IAiQ== X-Gm-Message-State: ALoCoQmkR91il7H5RMCTF/MD6+QUgqCZjhw/7sNcm2SGQ6dBTeUuIXAe8oe9d7trznmQWMLp5KJm X-Received: by 10.28.221.134 with SMTP id u128mr23907220wmg.94.1447717216883; Mon, 16 Nov 2015 15:40:16 -0800 (PST) Received: from dorado.Home ([90.199.203.61]) by smtp.gmail.com with ESMTPSA id 5sm7152623wmx.23.2015.11.16.15.40.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Nov 2015 15:40:16 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Mon, 16 Nov 2015 23:40:03 +0000 Message-Id: <1447717205-27780-4-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1447717205-27780-1-git-send-email-michael.g.wood@intel.com> References: <1447717205-27780-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 3/5] toaster: tables Add default_orderby field where it was missing or unset 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: Mon, 16 Nov 2015 23:40:20 -0000 This value is used to set the default ordering of the model that is used for ToasterTables, it is picked up client side to set the ordering indicator. [YOCTO #8695] Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/tables.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/tables.py b/bitbake/lib/toaster/toastergui/tables.py index be8916c..44a89d9 100644 --- a/bitbake/lib/toaster/toastergui/tables.py +++ b/bitbake/lib/toaster/toastergui/tables.py @@ -295,6 +295,7 @@ class LayerMachinesTable(MachinesTable): MachinesTable.setup_queryset(self, *args, **kwargs) self.queryset = self.queryset.filter(layer_version__pk=int(kwargs['layerid'])) + self.queryset = self.queryset.order_by(self.default_orderby) self.static_context_extra['in_prj'] = ProjectLayer.objects.filter(Q(project=kwargs['pid']) & Q(layercommit=kwargs['layerid'])).count() def setup_columns(self, *args, **kwargs): @@ -319,7 +320,6 @@ class RecipesTable(ToasterTable, ProjectFiltersMixin): def __init__(self, *args, **kwargs): super(RecipesTable, self).__init__(*args, **kwargs) self.empty_state = "Toaster has no recipe information. To generate recipe information you can configure a layer source then run a build." - self.default_orderby = "name" build_col = { 'title' : "Build", 'help_text' : "Add or delete recipes to and from your project", @@ -356,7 +356,6 @@ class RecipesTable(ToasterTable, ProjectFiltersMixin): self.static_context_extra['current_layers'] = self.project_layers self.queryset = prj.get_all_compatible_recipes() - self.queryset = self.queryset.order_by(self.default_orderby) def setup_columns(self, *args, **kwargs): @@ -414,6 +413,7 @@ class LayerRecipesTable(RecipesTable): def __init__(self, *args, **kwargs): super(LayerRecipesTable, self).__init__(*args, **kwargs) + self.default_orderby = "name" def get_context_data(self, **kwargs): context = super(LayerRecipesTable, self).get_context_data(**kwargs) @@ -425,6 +425,7 @@ class LayerRecipesTable(RecipesTable): self.queryset = \ Recipe.objects.filter(layer_version__pk=int(kwargs['layerid'])) + self.queryset = self.queryset.order_by(self.default_orderby) self.static_context_extra['in_prj'] = ProjectLayer.objects.filter(Q(project=kwargs['pid']) & Q(layercommit=kwargs['layerid'])).count() def setup_columns(self, *args, **kwargs): @@ -451,6 +452,7 @@ class CustomImagesTable(ToasterTable): def __init__(self, *args, **kwargs): super(CustomImagesTable, self).__init__(*args, **kwargs) self.title = "Custom images" + self.default_orderby = "name" def get_context_data(self, **kwargs): context = super(CustomImagesTable, self).get_context_data(**kwargs) @@ -462,7 +464,7 @@ class CustomImagesTable(ToasterTable): def setup_queryset(self, *args, **kwargs): prj = Project.objects.get(pk = kwargs['pid']) self.queryset = CustomImageRecipe.objects.filter(project=prj) - self.queryset = self.queryset.order_by('name') + self.queryset = self.queryset.order_by(self.default_orderby) def setup_columns(self, *args, **kwargs): @@ -502,11 +504,13 @@ class ImageRecipesTable(RecipesTable): def __init__(self, *args, **kwargs): super(ImageRecipesTable, self).__init__(*args, **kwargs) self.title = "Compatible image recipes" + self.default_orderby = "name" def setup_queryset(self, *args, **kwargs): super(ImageRecipesTable, self).setup_queryset(*args, **kwargs) self.queryset = self.queryset.filter(is_image=True) + self.queryset = self.queryset.order_by(self.default_orderby) def setup_columns(self, *args, **kwargs): -- 2.5.0