Commit c7ce34e9 authored by Miquel Torres's avatar Miquel Torres
Browse files

Add field to set a project's default branch

parent 33b2a3d6
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-08-04 03:45
from __future__ import unicode_literals
from django.db import migrations, models
def get_default_branch_name():
from django.conf import settings
try:
return settings.DEF_BRANCH
except AttributeError:
return "master"
class Migration(migrations.Migration):
dependencies = [
('codespeed', '0002_median'),
]
operations = [
migrations.AddField(
model_name='project',
name='default_branch',
field=models.CharField(default=get_default_branch_name, max_length=32),
preserve_default=False,
),
migrations.AlterField(
model_name='branch',
name='name',
field=models.CharField(max_length=32),
),
]
......@@ -42,6 +42,7 @@ class Project(models.Model):
commit_browsing_url = models.CharField("Commit browsing URL",
blank=True, max_length=200)
track = models.BooleanField("Track changes", default=True)
default_branch = models.CharField(max_length=32)
def __str__(self):
return self.name
......@@ -103,7 +104,7 @@ class HistoricalValue(object):
@python_2_unicode_compatible
class Branch(models.Model):
name = models.CharField(max_length=20)
name = models.CharField(max_length=32)
project = models.ForeignKey(Project, related_name="branches")
def __str__(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment