diff --git a/arkindex/dataimport/migrations/0002_repository_revision.py b/arkindex/dataimport/migrations/0002_repository_revision.py index 93169f0c49328f5e214ceb0472fcebf75001ab3d..e97c33f85bb45d43abf2e99cc6f2d6674cb886f9 100644 --- a/arkindex/dataimport/migrations/0002_repository_revision.py +++ b/arkindex/dataimport/migrations/0002_repository_revision.py @@ -82,7 +82,7 @@ class Migration(migrations.Migration): name='watched_branches', field=arkindex.project.fields.ArrayField( base_field=models.CharField(max_length=50), - default=['refs/heads/master'], + default=arkindex.dataimport.models.repository_default_branches, size=None, ), ), diff --git a/arkindex/dataimport/models.py b/arkindex/dataimport/models.py index 500a52ad5a42d3392fa44c058daba05aab205dab..799d18347291e4f66a7a4fe82c59cc47f5c45aed 100644 --- a/arkindex/dataimport/models.py +++ b/arkindex/dataimport/models.py @@ -146,6 +146,15 @@ class RepositorySource(Enum): GitLab = 'gitlab' +def repository_default_branches(): + ''' + This is needed to avoid re-using the same list instance + as Repository.watched_branches default on new instances + See Django warning postgres.E003 + ''' + return list('refs/heads/master') + + class Repository(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4) url = models.URLField(unique=True) @@ -154,7 +163,7 @@ class Repository(models.Model): clone_token = models.CharField(max_length=250) corpus = models.ForeignKey('documents.Corpus', on_delete=models.CASCADE, related_name='repos') user = models.ForeignKey('users.User', on_delete=models.CASCADE, related_name='repos') - watched_branches = ArrayField(models.CharField(max_length=50), default=['refs/heads/master']) + watched_branches = ArrayField(models.CharField(max_length=50), default=repository_default_branches) class Meta: verbose_name_plural = 'repositories' diff --git a/requirements.txt b/requirements.txt index 6e67d2223c12169996f7e0c4d0d1fc7210e3ec39..47f9c1391f4c1d99f96573df956b5afea930a1ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ celery==4.2.0 celery_once==2.0.0 certifi==2017.7.27.1 chardet==3.0.4 -Django==2.0 +Django==2.1 django-enumfields==0.10.0 djangorestframework==3.7.1 django-webpack-loader==0.5.0