Konova Code fix

* adds command sync_codelist
    * provides updating of all codes to the newest version (id)
    * must be run once on staging, can be dropped afterwards since the root for the problem has been resolved on the codelist management application
This commit is contained in:
2022-05-31 16:53:13 +02:00
parent 58ce00a5a6
commit 7bacbecdec
6 changed files with 170 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
from django.db import migrations, models, transaction
import django.db.models.deletion
from codelist.settings import CODELIST_BIOTOPES_ID, CODELIST_AFTER_STATE_BIOTOPES__ID
from codelist.settings import CODELIST_BIOTOPES_ID, CODELIST_AFTER_STATE_BIOTOPES_ID
def migrate_entries_974_to_654(apps, schema_editor):
@@ -23,7 +23,7 @@ def migrate_entries_974_to_654(apps, schema_editor):
state.save()
old_list_states = CompensationState.objects.filter(
biotope_type__code_lists__in=[CODELIST_AFTER_STATE_BIOTOPES__ID]
biotope_type__code_lists__in=[CODELIST_AFTER_STATE_BIOTOPES_ID]
)
if old_list_states.count() > 0:
raise Exception("Still unmigrated values!")