diff --git a/colab/plugins/gitlab/migrations/0004_auto_20150630_1149.py b/colab/plugins/gitlab/migrations/0004_auto_20150630_1149.py new file mode 100644 index 0000000..16d7f92 --- /dev/null +++ b/colab/plugins/gitlab/migrations/0004_auto_20150630_1149.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('gitlab', '0003_auto_20150211_1203'), + ] + + operations = [ + migrations.AddField( + model_name='gitlabcomment', + name='iid', + field=models.IntegerField(null=True), + preserve_default=True, + ), + migrations.AddField( + model_name='gitlabmergerequest', + name='iid', + field=models.IntegerField(null=True), + preserve_default=True, + ), + ] diff --git a/colab/plugins/gitlab/models.py b/colab/plugins/gitlab/models.py index b6ed1c3..2d9640b 100644 --- a/colab/plugins/gitlab/models.py +++ b/colab/plugins/gitlab/models.py @@ -27,6 +27,7 @@ class GitlabProject(models.Model, HitCounterModelMixin): class GitlabMergeRequest(Collaboration): id = models.IntegerField(primary_key=True) + iid = models.IntegerField(null=True) target_branch = models.TextField() source_branch = models.TextField() project = models.ForeignKey(GitlabProject, null=True, @@ -50,7 +51,7 @@ class GitlabMergeRequest(Collaboration): @property def url(self): return u'/gitlab/{}/merge_requests/{}'.format( - self.project.path_with_namespace, self.id) + self.project.path_with_namespace, self.iid) def get_author(self): return self.user @@ -91,6 +92,7 @@ class GitlabIssue(Collaboration): class GitlabComment(Collaboration): id = models.IntegerField(primary_key=True) + iid = models.IntegerField(null=True) body = models.TextField() created_at = models.DateTimeField(blank=True, null=True) issue_comment = models.BooleanField(default=True) @@ -133,10 +135,10 @@ class GitlabComment(Collaboration): def url(self): if self.issue_comment: return u'/gitlab/{}/issues/{}#notes_{}'.format( - self.project.path_with_namespace, self.parent_id, self.id) + self.project.path_with_namespace, self.parent_id, self.iid) else: return u'/gitlab/{}/merge_requests/{}#notes_{}'.format( - self.project.path_with_namespace, self.parent_id, self.id) + self.project.path_with_namespace, self.parent_id, self.iid) class Meta: verbose_name = _('Gitlab Comments') -- libgit2 0.21.2