Commits

Steve Losh  committed a672b28

Add a view to run a build.

  • Participants
  • Parent commits 24567de

Comments (0)

Files changed (3)

File integration/models.py

     
     @models.permalink
     def get_absolute_url(self):
-        return ('Project', [self.id])
+        return ('project_detail', (), { 'slug': self.slug } )
     
 
 class BuildRun(models.Model):
     
     @models.permalink
     def get_absolute_url(self):
-        return ('BuildRun', [self.id])
+        return ('build_detail', (), { 'slug': self.project.slug, 'id': self.id } )
     

File integration/views.py

     
     return render_to_response('integration/build.html',
         { 'run': run, 'hours': hours, 'minutes': minutes, 'seconds': seconds },
-        context_instance=RequestContext(request) )
+        context_instance=RequestContext(request) )
+
+def run_build(request, slug):
+    project = get_object_or_404(Project, slug=slug)
+    project.run_build()
+    return HttpResponseRedirect(project.get_absolute_url())
 urlpatterns += patterns('tinpan.integration.views',
     url(r'^$',                                     'overview',       name='overview'),
     url(r'^(?P<slug>[\w_-]+)/$',                   'project_detail', name='project_detail'),
+    url(r'^(?P<slug>[\w_-]+)/run/$',               'run_build',      name='run_build'),
     url(r'^(?P<slug>[\w_-]+)/build/(?P<id>\d+)/$', 'build_detail',   name='build_detail'),
 )