diff --git a/instance/migrations/0024_auto_20150911_2304.py b/instance/migrations/0024_auto_20150911_2304.py new file mode 100644 index 000000000..6b04939a3 --- /dev/null +++ b/instance/migrations/0024_auto_20150911_2304.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('instance', '0023_openedxinstance_ansible_source_repo_url'), + ] + + operations = [ + migrations.AlterModelOptions( + name='instancelogentry', + options={'verbose_name_plural': 'Instance Log Entries'}, + ), + migrations.AlterModelOptions( + name='serverlogentry', + options={'verbose_name_plural': 'Server Log Entries'}, + ), + migrations.AddField( + model_name='openedxinstance', + name='github_pr_number', + field=models.IntegerField(null=True, blank=True), + ), + migrations.AlterField( + model_name='openedxinstance', + name='base_domain', + field=models.CharField(max_length=50, default='example.com'), + ), + ] diff --git a/instance/models/instance.py b/instance/models/instance.py index 8bb302a28..dd1b621d5 100644 --- a/instance/models/instance.py +++ b/instance/models/instance.py @@ -204,6 +204,7 @@ class GitHubInstanceMixin(VersionControlInstanceMixin): """ github_organization_name = models.CharField(max_length=200, db_index=True) github_repository_name = models.CharField(max_length=200, db_index=True) + github_pr_number = models.IntegerField(blank=True, null=True) github_admin_organization_name = models.CharField(max_length=200, blank=True, default=settings.DEFAULT_ADMIN_ORGANIZATION) @@ -233,6 +234,15 @@ def github_base_url(self): """ return 'https://github.com/{0.fork_name}'.format(self) + @property + def github_pr_url(self): + """ + Web URL of the Github PR, or None if the PR number is not set. + """ + if self.github_pr_number is None: + return None + return '{0.github_base_url}/pull/{0.github_pr_number}'.format(self) + @property def github_branch_url(self): """ diff --git a/instance/serializers.py b/instance/serializers.py index 900cbb17a..b9f61e7fc 100644 --- a/instance/serializers.py +++ b/instance/serializers.py @@ -71,6 +71,8 @@ class Meta: 'email', 'github_base_url', 'github_branch_url', + 'github_pr_number', + 'github_pr_url', 'log_text', 'github_organization_name', 'modified', diff --git a/instance/static/html/instance/index.html b/instance/static/html/instance/index.html index 2fbd7cdb8..7fde896b8 100644 --- a/instance/static/html/instance/index.html +++ b/instance/static/html/instance/index.html @@ -50,7 +50,12 @@