diff mbox

[Branch,~linaro-validation/lava-dashboard/trunk] Rev 418: Fix for bug 1220416

Message ID 20130905160127.17889.79751.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Tyler Baker Sept. 5, 2013, 4:01 p.m. UTC
Merge authors:
  Fu Wei (fu-wei)
------------------------------------------------------------
revno: 418 [merge]
committer: Tyler Baker <tyler.baker@linaro.org>
branch nick: lava-dashboard
timestamp: Thu 2013-09-05 09:00:38 -0700
message:
  Fix for bug 1220416
modified:
  dashboard_app/models.py
  dashboard_app/templates/dashboard_app/_test_run_list_table.html


--
lp:lava-dashboard
https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk

You are subscribed to branch lp:lava-dashboard.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'dashboard_app/models.py'
--- dashboard_app/models.py	2013-09-02 20:36:10 +0000
+++ dashboard_app/models.py	2013-09-05 16:00:38 +0000
@@ -1029,6 +1029,21 @@ 
     class Meta:
         ordering = ['-import_assigned_date']
 
+    def show_device(self):
+        all_attributes = self.attributes.all()
+        for one_attributes in all_attributes:
+            if one_attributes.name == "target":
+                return one_attributes.value
+
+        for one_attributes in all_attributes:
+            if one_attributes.name == "target.hostname":
+                return one_attributes.value
+
+        for one_attributes in all_attributes:
+            if one_attributes.name == "target.device_type":
+                return one_attributes.value
+        return "Target Device"
+
 
 class TestRunDenormalization(models.Model):
     """

=== modified file 'dashboard_app/templates/dashboard_app/_test_run_list_table.html'
--- dashboard_app/templates/dashboard_app/_test_run_list_table.html	2013-08-14 11:32:27 +0000
+++ dashboard_app/templates/dashboard_app/_test_run_list_table.html	2013-09-05 10:26:43 +0000
@@ -14,11 +14,7 @@ 
   <tbody>
     {% for test_run in test_run_list %}
     <tr>
-      {% for attribute in test_run.attributes.all %}
-        {% if attribute.name == "target" %}
-        <td>{{ attribute.value }}</td>
-        {% endif %}
-      {% endfor %}
+      <td>{{ test_run.show_device }}</td>
       <td><a href="{{ test_run.get_absolute_url }}"><code>{{ test_run.test }} results<code/></a></td>
       <td>{{ test_run.test }}</td>
       <td>{{ test_run.get_summary_results.pass }}</td>