mpeltriaux
f441ed94f5
* adds handler code list usage to forms and models * updates tests * extends API for handler code handling
41 lines
1.9 KiB
Python
41 lines
1.9 KiB
Python
# Generated by Django 3.1.3 on 2022-01-14 08:36
|
|
from django.core.management import call_command
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
def load_initial_codes(apps, schema_editor):
|
|
call_command('update_codelist')
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='KonovaCode',
|
|
fields=[
|
|
('id', models.IntegerField(help_text='Regular Id', primary_key=True, serialize=False)),
|
|
('atom_id', models.IntegerField(blank=True, help_text='AtomId; Identifies this code uniquely over all NatIT projects; Duplicates possible', null=True)),
|
|
('short_name', models.CharField(blank=True, help_text='Short version of long name', max_length=500, null=True)),
|
|
('long_name', models.CharField(blank=True, max_length=1000, null=True)),
|
|
('is_selectable', models.BooleanField(default=False, help_text='Whether this code shall be used for any select actions or not')),
|
|
('is_leaf', models.BooleanField(default=False, help_text='Whether this code has children or not')),
|
|
('is_archived', models.BooleanField(default=False, help_text='Whether this code is archived or not')),
|
|
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='codelist.konovacode')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='KonovaCodeList',
|
|
fields=[
|
|
('id', models.IntegerField(help_text='List identifier', primary_key=True, serialize=False)),
|
|
('codes', models.ManyToManyField(blank=True, help_text='Codes for this list', related_name='code_lists', to='codelist.KonovaCode')),
|
|
],
|
|
),
|
|
migrations.RunPython(load_initial_codes),
|
|
]
|