|
5 | 5 | import logging |
6 | 6 | import django |
7 | 7 |
|
| 8 | +from django.conf import settings |
8 | 9 | from django.core.urlresolvers import reverse |
9 | 10 | from django.core.exceptions import ValidationError, ObjectDoesNotExist |
10 | 11 | from django.http import HttpResponse, Http404, HttpResponseBadRequest,\ |
11 | 12 | HttpResponseNotFound |
| 13 | +from django.db.models import F |
12 | 14 | from django.shortcuts import get_object_or_404, render_to_response |
13 | 15 | from django.views.decorators.http import require_GET, require_POST |
14 | 16 | from django.views.decorators.csrf import csrf_exempt |
15 | 17 | from django.template import RequestContext |
16 | | -from django.conf import settings |
17 | | -from .auth import basic_auth_required |
18 | 18 |
|
| 19 | +from .auth import basic_auth_required |
19 | 20 | from .models import (Environment, Report, Project, Revision, Result, |
20 | 21 | Executable, Benchmark, Branch) |
21 | 22 | from .views_data import (get_default_environment, getbaselineexecutables, |
@@ -281,16 +282,11 @@ def gettimelinedata(request): |
281 | 282 | 'baseline': "None", |
282 | 283 | } |
283 | 284 | append = False |
284 | | - for proj in Project.objects.filter(track=True): |
285 | | - try: |
286 | | - branch = Branch.objects.get( |
287 | | - project=proj, name=proj.default_branch) |
288 | | - except Branch.DoesNotExist: |
289 | | - continue |
290 | | - |
291 | | - # For now, we'll only work with trunk branches |
| 285 | + for branch in Branch.objects.filter( |
| 286 | + project__track=True, name=F('project__default_branch')): |
| 287 | + # For now, we'll only work with default branches |
292 | 288 | for executable in executables: |
293 | | - if executable.project != proj: |
| 289 | + if executable.project != branch.project: |
294 | 290 | continue |
295 | 291 |
|
296 | 292 | resultquery = Result.objects.filter( |
|
0 commit comments