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

@@ -2,7 +2,7 @@
from django.db import migrations, transaction
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_biotopes_from_974_to_654(apps, schema_editor):
@@ -23,7 +23,7 @@ def migrate_biotopes_from_974_to_654(apps, schema_editor):
all_states = CompensationState.objects.all()
after_state_list_elements = all_states.filter(
biotope_type__code_lists__in=[CODELIST_AFTER_STATE_BIOTOPES__ID]
biotope_type__code_lists__in=[CODELIST_AFTER_STATE_BIOTOPES_ID]
)
if after_state_list_elements.count() > 0:
raise Exception("Still states with wrong codelist entries!")