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 <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexandru DAMIAN 2014-02-13 13:36:54 +00:00 committed by Richard Purdie
parent 4ae598195b
commit 7008a24792
3 changed files with 7 additions and 12 deletions

View 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

View File

@ -115,11 +115,7 @@
<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>

View File

@ -30,13 +30,7 @@
<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>