bitbake: toastergui: fix task executed status display
authorAlexandru DAMIAN <alexandru.damian@intel.com>
Thu, 13 Feb 2014 13:36:54 +0000 (13:36 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 Mar 2014 19:23:57 +0000 (12:23 -0700)
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 <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/toaster/orm/models.py
bitbake/lib/toaster/toastergui/templates/recipe.html
bitbake/lib/toaster/toastergui/templates/tasks.html

index c77df22..f96da9c 100644 (file)
@@ -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
index eba15ba..1adb012 100644 (file)
                         <i class="icon-question-sign get-help hover-help" title="This task fetches the source code"></i>
                     </td>
 
-                    {% if task.task_executed %}
-                    <td><a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">Executed</a></td>
-                    {% else %}
-                    <td><a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">Prebuilt</a></td>
-                    {% endif %}
+                    <td><a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">{{task.get_executed_display}}</a></td>
 
                     <td><a {{ task|task_color }} href="{% url "task" build.pk task.pk %}">{{task.get_outcome_display}}</a></td>
                     <td>
index 6831f10..3479e7e 100644 (file)
                     <a href="{%url "task" build.pk task.pk%} ">{{task.task_name}}</a>
                 </td>
                 <td class="executed">
-                    <a href="{%url "task" build.pk task.pk%} ">
-                    {% if task.task_executed %}
-                        Executed
-                    {% else %}
-                        Not executed
-                    {% endif %}
-                    </a>
+                    <a href="{%url "task" build.pk task.pk%} ">{{task.get_executed_display}}</a>
                 </td>
                 <td class="outcome">
                     <a href="{%url "task" build.pk task.pk%} ">{{task.get_outcome_display}}</a>