Skip to content

Commit 2f6694a

Browse files
committed
Add new "display_on_comparison_page" field to the Branch model which
allows users to filter out which branches are displayed in the Executable sidebar on the comparision page. For backward compatibility reasons, we default it to True (aka display all the branches).
1 parent 2de039c commit 2f6694a

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

codespeed/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class ProjectAdmin(admin.ModelAdmin):
3737

3838
@admin.register(Branch)
3939
class BranchAdmin(admin.ModelAdmin):
40-
list_display = ('name', 'project')
40+
list_display = ('name', 'project', 'display_on_comparison_page')
4141
list_filter = ('project',)
4242

4343

codespeed/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ class Branch(models.Model):
107107
name = models.CharField(max_length=32)
108108
project = models.ForeignKey(
109109
Project, on_delete=models.CASCADE, related_name="branches")
110+
display_on_comparison_page = models.BooleanField(
111+
"True to display this branch in a list on the comparison page",
112+
default=True)
110113

111114
def __str__(self):
112115
return self.project.name + ":" + self.name

codespeed/views_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def getcomparisonexes():
120120
executables.append(exe)
121121

122122
# add latest revs of the project
123-
branches = Branch.objects.filter(project=proj)
123+
branches = Branch.objects.filter(project=proj, display_on_comparison_page=True)
124124
for branch in branches:
125125
try:
126126
rev = Revision.objects.filter(branch=branch).latest('date')

0 commit comments

Comments
 (0)