From 7008a24792704b8e757c583663636addf49f397d Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Thu, 13 Feb 2014 13:36:54 +0000 Subject: bitbake: toastergui: fix task executed status display The proper way to get a display-able value in Django is to use a model method instead of clutter the template with if/else. [YOCTO #5641] (Bitbake rev: bb21b71dab70db163b804c7ebf27b85c59a39112) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/toaster/orm/models.py | 5 +++++ bitbake/lib/toaster/toastergui/templates/recipe.html | 6 +----- bitbake/lib/toaster/toastergui/templates/tasks.html | 8 +------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index c77df2243e..f96da9c339 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py @@ -116,6 +116,11 @@ class Task(models.Model): def get_related_setscene(self): return Task.objects.related_setscene(self) + def get_executed_display(self): + if self.task_executed: + return "Executed" + return "Not Executed" + build = models.ForeignKey(Build, related_name='task_build') order = models.IntegerField(null=True) task_executed = models.BooleanField(default=False) # True means Executed, False means Not/Executed diff --git a/bitbake/lib/toaster/toastergui/templates/recipe.html b/bitbake/lib/toaster/toastergui/templates/recipe.html index eba15baad3..1adb012189 100644 --- a/bitbake/lib/toaster/toastergui/templates/recipe.html +++ b/bitbake/lib/toaster/toastergui/templates/recipe.html @@ -115,11 +115,7 @@ - {% if task.task_executed %} - Executed - {% else %} - Prebuilt - {% endif %} + {{task.get_executed_display}} {{task.get_outcome_display}} diff --git a/bitbake/lib/toaster/toastergui/templates/tasks.html b/bitbake/lib/toaster/toastergui/templates/tasks.html index 6831f106c0..3479e7e1e7 100644 --- a/bitbake/lib/toaster/toastergui/templates/tasks.html +++ b/bitbake/lib/toaster/toastergui/templates/tasks.html @@ -30,13 +30,7 @@ {{task.task_name}} - - {% if task.task_executed %} - Executed - {% else %} - Not executed - {% endif %} - + {{task.get_executed_display}} {{task.get_outcome_display}} -- cgit v1.2.3-54-g00ecf