Fixed dataset_repo migration (#3827)
parent
3f8b9e4823
commit
1db66e7032
@ -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
|
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):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('dataset_repo', '0005_auto_20201019_1100'),
|
('dataset_repo', '0005_auto_20201019_1100'),
|
||||||
]
|
]
|
||||||
|
|
||||||
replaces = [('git', '0006_gitdata_format')]
|
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='gitdata',
|
model_name='gitdata',
|
||||||
name='format',
|
name='format',
|
||||||
field=models.CharField(max_length=256)
|
field=models.CharField(blank=True, max_length=256),
|
||||||
),
|
),
|
||||||
|
migrations.RunPython(update_default_format_field),
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue