From 87c364a10472545549ab285c76d488606184569f Mon Sep 17 00:00:00 2001 From: jonaswinkler <17569239+jonaswinkler@users.noreply.github.com> Date: Wed, 24 Feb 2021 23:52:25 +0100 Subject: [PATCH] adjust migration --- src/documents/admin.py | 6 +++--- ...igrate_tag_colour.py => 1013_migrate_tag_colour.py} | 10 +++++----- src/documents/models.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) rename src/documents/migrations/{1006_migrate_tag_colour.py => 1013_migrate_tag_colour.py} (85%) diff --git a/src/documents/admin.py b/src/documents/admin.py index aee45b49d..c8c16d791 100755 --- a/src/documents/admin.py +++ b/src/documents/admin.py @@ -19,12 +19,12 @@ class TagAdmin(admin.ModelAdmin): list_display = ( "name", - "colour", + "color", "match", "matching_algorithm" ) - list_filter = ("colour", "matching_algorithm") - list_editable = ("colour", "match", "matching_algorithm") + list_filter = ("color", "matching_algorithm") + list_editable = ("color", "match", "matching_algorithm") class DocumentTypeAdmin(admin.ModelAdmin): diff --git a/src/documents/migrations/1006_migrate_tag_colour.py b/src/documents/migrations/1013_migrate_tag_colour.py similarity index 85% rename from src/documents/migrations/1006_migrate_tag_colour.py rename to src/documents/migrations/1013_migrate_tag_colour.py index d9bea8355..0c1189074 100644 --- a/src/documents/migrations/1006_migrate_tag_colour.py +++ b/src/documents/migrations/1013_migrate_tag_colour.py @@ -25,7 +25,7 @@ def forward(apps, schema_editor): for tag in Tag.objects.all(): colour_old_id = tag.colour_old rgb = COLOURS_OLD[colour_old_id] - tag.colour = rgb + tag.color = rgb tag.save() @@ -40,7 +40,7 @@ def reverse(apps, schema_editor): return 1 for tag in Tag.objects.all(): - colour_id = _get_colour_id(tag.colour) + colour_id = _get_colour_id(tag.color) tag.colour_old = colour_id tag.save() @@ -48,7 +48,7 @@ def reverse(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('documents', '1005_checksums'), + ('documents', '1012_fix_archive_files'), ] operations = [ @@ -59,8 +59,8 @@ class Migration(migrations.Migration): ), migrations.AddField( model_name='tag', - name='colour', - field=models.CharField(blank=True, max_length=7), + name='color', + field=models.CharField(blank=True, max_length=7, verbose_name='color'), ), migrations.RunPython(forward, reverse), migrations.RemoveField( diff --git a/src/documents/models.py b/src/documents/models.py index 47361776a..9c5b14806 100755 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -78,7 +78,7 @@ class Correspondent(MatchingModel): class Tag(MatchingModel): - colour = models.CharField( + color = models.CharField( _("color"), blank=True, max_length=7)