From eca160f4e10ebe99e9377d61be36e9e2278cc78b Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov Date: Tue, 26 Oct 2021 12:47:49 +0300 Subject: [PATCH 1/2] fixed migration --- .../dataset_repo/migrations/0006_gitdata_format.py | 14 ++++++++++---- cvat/apps/dataset_repo/models.py | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cvat/apps/dataset_repo/migrations/0006_gitdata_format.py b/cvat/apps/dataset_repo/migrations/0006_gitdata_format.py index 350810f746cc..641d246743eb 100644 --- a/cvat/apps/dataset_repo/migrations/0006_gitdata_format.py +++ b/cvat/apps/dataset_repo/migrations/0006_gitdata_format.py @@ -1,19 +1,25 @@ -# Generated by Django 2.1.3 on 2019-02-05 17:08 +# Generated by Django 3.1.13 on 2021-10-26 10:10 from django.db import migrations, models +def update_default_format_field(apps, schema_editor): + GitData = apps.get_model('dataset_repo', 'GitData') + for git_data in GitData.objects.all(): + if not git_data.format: + git_data.format = 'CVAT for images 1.1' if git_data.task.mode == 'annotation' else 'CVAT for video 1.1' + git_data.save() class Migration(migrations.Migration): + dependencies = [ ('dataset_repo', '0005_auto_20201019_1100'), ] - replaces = [('git', '0006_gitdata_format')] - operations = [ migrations.AddField( model_name='gitdata', name='format', - field=models.CharField(max_length=256) + field=models.CharField(blank=True, max_length=256), ), + migrations.RunPython(update_default_format_field), ] diff --git a/cvat/apps/dataset_repo/models.py b/cvat/apps/dataset_repo/models.py index 0249fdc80367..08092c9ce4d4 100644 --- a/cvat/apps/dataset_repo/models.py +++ b/cvat/apps/dataset_repo/models.py @@ -20,7 +20,7 @@ class GitData(models.Model): task = models.OneToOneField(Task, on_delete = models.CASCADE, primary_key = True) url = models.URLField(max_length = 2000) path = models.CharField(max_length=256) - format = models.CharField(max_length=256) + format = models.CharField(max_length=256, blank=True) sync_date = models.DateTimeField(auto_now_add=True) status = models.CharField(max_length=20, default=GitStatusChoice.NON_SYNCED) lfs = models.BooleanField(default=True) From 8f25a5eb39890920664d350e0ddd62b4262263c2 Mon Sep 17 00:00:00 2001 From: Andrey Zhavoronkov Date: Tue, 26 Oct 2021 13:57:40 +0300 Subject: [PATCH 2/2] updtaed changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19a1c70ae311..7015908c0f84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Incorrect work when copy job list with "Copy" button () - Iterating over manifest () - Manifest removing () +- Migration of `dataset_repo` application () ### Security