# Generated by Django 2.2.24 on 2025-08-25 10:14 import ishtar_common.models_common import django.core.validators from django.db import migrations, models import re SQL_MIGRATE_1 = """ INSERT INTO archaeological_finds_find_museum_donors (find_id, biographicalnote_id) SELECT id, museum_donor_id FROM archaeological_finds_find WHERE museum_donor_id IS NOT NULL; """ SQL_MIGRATE_2 = """ INSERT INTO archaeological_finds_find_museum_collections (find_id, museumcollection_id) SELECT id, museum_collection_id FROM archaeological_finds_find WHERE museum_collection_id IS NOT NULL; """ class Migration(migrations.Migration): dependencies = [ ('ishtar_common', '0263_media_exporter'), ('archaeological_finds', '0137_data_migration_treatment_status_inputstatus'), ] operations = [ migrations.AddField( model_name='find', name='museum_donors', field=models.ManyToManyField(blank=True, related_name='finds_donors', to='ishtar_common.BiographicalNote', verbose_name='Donors, testators or vendors'), ), migrations.RunSQL(SQL_MIGRATE_1), migrations.RemoveField( model_name='find', name='museum_donor', ), migrations.RemoveField( model_name='historicalfind', name='museum_donor', ), migrations.CreateModel( name='OwnerType', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('label', models.TextField(verbose_name='Label')), ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), ('comment', models.TextField(blank=True, default='', verbose_name='Comment')), ('available', models.BooleanField(default=True, verbose_name='Available')), ('order', models.IntegerField(default=10, verbose_name='Order')), ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_finds.OwnerType', verbose_name='Parent')), ], options={ 'verbose_name': 'Ownership type', 'verbose_name_plural': 'Owner types', 'ordering': ('order', 'parent__label', 'label'), }, bases=(ishtar_common.models_common.Cached, models.Model), ), migrations.CreateModel( name='OwnershipStatus', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('label', models.TextField(verbose_name='Label')), ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z'), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), ('comment', models.TextField(blank=True, default='', verbose_name='Comment')), ('available', models.BooleanField(default=True, verbose_name='Available')), ('order', models.IntegerField(default=10, verbose_name='Order')), ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_finds.OwnershipStatus', verbose_name='Parent')), ], options={ 'verbose_name': 'Ownership status', 'verbose_name_plural': 'Ownership status', 'ordering': ('order', 'parent__label', 'label'), }, bases=(ishtar_common.models_common.Cached, models.Model), ), migrations.AddField( model_name='find', name='owner', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_finds.OwnerType', verbose_name='Owner'), ), migrations.AddField( model_name='find', name='ownership_status', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_finds.OwnershipStatus', verbose_name='Ownership status'), ), migrations.AddField( model_name='historicalfind', name='owner', field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_finds.OwnerType', verbose_name='Owner'), ), migrations.AddField( model_name='historicalfind', name='ownership_status', field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='archaeological_finds.OwnershipStatus', verbose_name='Ownership status'), ), migrations.AddField( model_name='find', name='museum_collections', field=models.ManyToManyField(blank=True, to='archaeological_finds.MuseumCollection', verbose_name='Collections'), ), migrations.RunSQL(SQL_MIGRATE_2), migrations.RemoveField( model_name='find', name='museum_collection', ), migrations.RemoveField( model_name='historicalfind', name='museum_collection', ), migrations.RemoveField( model_name='find', name='collection', ), migrations.RemoveField( model_name='historicalfind', name='collection', ), ]