Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gabriel Silva Vinha
codespeed
Commits
3743ece0
Commit
3743ece0
authored
Aug 16, 2017
by
Miquel Torres
Browse files
Use F expresion to get default branches
parent
b8a408ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
codespeed/views.py
View file @
3743ece0
...
...
@@ -5,17 +5,18 @@ import json
import
logging
import
django
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.core.exceptions
import
ValidationError
,
ObjectDoesNotExist
from
django.http
import
HttpResponse
,
Http404
,
HttpResponseBadRequest
,
\
HttpResponseNotFound
from
django.db.models
import
F
from
django.shortcuts
import
get_object_or_404
,
render_to_response
from
django.views.decorators.http
import
require_GET
,
require_POST
from
django.views.decorators.csrf
import
csrf_exempt
from
django.template
import
RequestContext
from
django.conf
import
settings
from
.auth
import
basic_auth_required
from
.auth
import
basic_auth_required
from
.models
import
(
Environment
,
Report
,
Project
,
Revision
,
Result
,
Executable
,
Benchmark
,
Branch
)
from
.views_data
import
(
get_default_environment
,
getbaselineexecutables
,
...
...
@@ -281,16 +282,11 @@ def gettimelinedata(request):
'baseline'
:
"None"
,
}
append
=
False
for
proj
in
Project
.
objects
.
filter
(
track
=
True
):
try
:
branch
=
Branch
.
objects
.
get
(
project
=
proj
,
name
=
proj
.
default_branch
)
except
Branch
.
DoesNotExist
:
continue
# For now, we'll only work with trunk branches
for
branch
in
Branch
.
objects
.
filter
(
project__track
=
True
,
name
=
F
(
'project__default_branch'
)):
# For now, we'll only work with default branches
for
executable
in
executables
:
if
executable
.
project
!=
proj
:
if
executable
.
project
!=
branch
.
proj
ect
:
continue
resultquery
=
Result
.
objects
.
filter
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment