Add new instrument type

This commit is contained in:
Ramon Wenger 2022-03-01 10:57:49 +01:00
parent b921c9b2c6
commit a993eeacfc
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
# Generated by Django 2.2.26 on 2022-03-01 09:53
from django.db import migrations
from basicknowledge.models import LANGUAGE_COMMUNICATION, SOCIETY
from core.logger import get_logger
logger = get_logger(__name__)
def create_new_types(apps, schema_editor):
InstrumentType = apps.get_model('basicknowledge', 'InstrumentType')
language_communication_types = [
'Bericht',
]
society_types = []
for type_name in language_communication_types:
obj, created = InstrumentType.objects.get_or_create(name=type_name, category=LANGUAGE_COMMUNICATION)
for type_name in society_types:
obj, created = InstrumentType.objects.get_or_create(name=type_name, category=SOCIETY)
class Migration(migrations.Migration):
dependencies = [
('basicknowledge', '0014_auto_20211129_1038'),
]
operations = [
migrations.RunPython(create_new_types, migrations.RunPython.noop)
]