Commits

Steve Losh committed 957ae10

Add the build status to the overview page.

Comments (0)

Files changed (3)

integration/models.py

     class Meta:
         ordering = ['name']
     
+    def last_build(self):
+        print dir(self)
+        return self.buildrun_set.order_by('-end_time')[0]
+    
     def __unicode__(self):
         return u"%s" % self.name
     

integration/views.py

 from django.contrib.auth.models import User
 from django.http import HttpResponseRedirect, HttpResponseForbidden
 from django.contrib.auth.decorators import login_required
+from django.db.models import Max
 from tinpan.integration.models import Project
 
 def overview(request):

templates/integration/overview.html

 {% block title %}Overview - {% endblock title %}
 
 {% block content %}
+    <h1>tinpan projects</h1>
     {% for project in projects %}
-        <h1>{{ project.name }}</h1>
+        <h2>{{ project.name }}</h2>
+        <p class="project-status">
+            Last build:
+            {% if project.last_build.success %}
+                Succeeded
+            {% else %}
+                Failed
+            {% endif %}
+            at
+            {{ project.last_build.end_time }}</p>
     {% endfor %}
 {% endblock content %}