Skip to content

Commit c7ce34e

Browse files
committed
Add field to set a project's default branch
1 parent 33b2a3d commit c7ce34e

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.9.13 on 2017-08-04 03:45
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
7+
8+
def get_default_branch_name():
9+
from django.conf import settings
10+
try:
11+
return settings.DEF_BRANCH
12+
except AttributeError:
13+
return "master"
14+
15+
16+
class Migration(migrations.Migration):
17+
18+
dependencies = [
19+
('codespeed', '0002_median'),
20+
]
21+
22+
operations = [
23+
migrations.AddField(
24+
model_name='project',
25+
name='default_branch',
26+
field=models.CharField(default=get_default_branch_name, max_length=32),
27+
preserve_default=False,
28+
),
29+
migrations.AlterField(
30+
model_name='branch',
31+
name='name',
32+
field=models.CharField(max_length=32),
33+
),
34+
]

codespeed/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Project(models.Model):
4242
commit_browsing_url = models.CharField("Commit browsing URL",
4343
blank=True, max_length=200)
4444
track = models.BooleanField("Track changes", default=True)
45+
default_branch = models.CharField(max_length=32)
4546

4647
def __str__(self):
4748
return self.name
@@ -103,7 +104,7 @@ def is_less_important_than(self, val, color):
103104

104105
@python_2_unicode_compatible
105106
class Branch(models.Model):
106-
name = models.CharField(max_length=20)
107+
name = models.CharField(max_length=32)
107108
project = models.ForeignKey(Project, related_name="branches")
108109

109110
def __str__(self):

0 commit comments

Comments
 (0)