# Generated by Django 2.2.4 on 2019-08-09 10:40

from django.db import migrations, models
import django.db.models.deletion
import lino.core.choicelists
import lino.core.fields
import lino.utils.mldbc.fields
import lino_xl.lib.countries.choicelists


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Country',
            fields=[
                ('name', lino.utils.mldbc.fields.BabelCharField(help_text='The designation of this country.', max_length=200, verbose_name='Designation')),
                ('isocode', models.CharField(help_text='The two-letter code for this country as defined by ISO 3166-1.\nFor countries that no longer exist it may be a 4-letter code.', max_length=4, primary_key=True, serialize=False, verbose_name='ISO code')),
                ('short_code', models.CharField(blank=True, help_text='A short abbreviation for regional usage. Obsolete.', max_length=4, verbose_name='Short code')),
                ('iso3', models.CharField(blank=True, help_text='The three-letter code for this country as defined by ISO 3166-1.', max_length=3, verbose_name='ISO-3 code')),
                ('name_de', models.CharField(blank=True, max_length=200, verbose_name='Designation (de)')),
                ('name_fr', models.CharField(blank=True, max_length=200, verbose_name='Designation (fr)')),
            ],
            options={
                'verbose_name': 'Country',
                'verbose_name_plural': 'Countries',
                'ordering': ['isocode'],
                'abstract': False,
            },
            bases=(models.Model, lino.core.fields.TableRow),
        ),
        migrations.CreateModel(
            name='Place',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', lino.utils.mldbc.fields.BabelCharField(max_length=200, verbose_name='Designation')),
                ('zip_code', models.CharField(blank=True, max_length=8)),
                ('type', lino.core.choicelists.ChoiceListField(blank=True, choicelist=lino_xl.lib.countries.choicelists.PlaceTypes, choices=[(lino_xl.lib.countries.choicelists.PlaceType('10', 'Member State'), 'Member State'), (lino_xl.lib.countries.choicelists.PlaceType('11', 'Division'), 'Division'), (lino_xl.lib.countries.choicelists.PlaceType('12', 'Region'), 'Region'), (lino_xl.lib.countries.choicelists.PlaceType('13', 'Community'), 'Community'), (lino_xl.lib.countries.choicelists.PlaceType('14', 'Territory'), 'Territory'), (lino_xl.lib.countries.choicelists.PlaceType('20', 'County', 'county'), 'County'), (lino_xl.lib.countries.choicelists.PlaceType('21', 'Province', 'province'), 'Province'), (lino_xl.lib.countries.choicelists.PlaceType('22', 'Shire'), 'Shire'), (lino_xl.lib.countries.choicelists.PlaceType('23', 'Subregion'), 'Subregion'), (lino_xl.lib.countries.choicelists.PlaceType('24', 'Department'), 'Department'), (lino_xl.lib.countries.choicelists.PlaceType('25', 'Arrondissement'), 'Arrondissement'), (lino_xl.lib.countries.choicelists.PlaceType('26', 'Prefecture'), 'Prefecture'), (lino_xl.lib.countries.choicelists.PlaceType('27', 'District', 'district'), 'District'), (lino_xl.lib.countries.choicelists.PlaceType('28', 'Sector'), 'Sector'), (lino_xl.lib.countries.choicelists.PlaceType('50', 'City', 'city'), 'City'), (lino_xl.lib.countries.choicelists.PlaceType('51', 'Town', 'town'), 'Town'), (lino_xl.lib.countries.choicelists.PlaceType('52', 'Municipality', 'municipality'), 'Municipality'), (lino_xl.lib.countries.choicelists.PlaceType('54', 'Parish', 'parish'), 'Parish'), (lino_xl.lib.countries.choicelists.PlaceType('55', 'Township', 'township'), 'Township'), (lino_xl.lib.countries.choicelists.PlaceType('56', 'Quarter', 'quarter'), 'Quarter'), (lino_xl.lib.countries.choicelists.PlaceType('61', 'Borough', 'borough'), 'Borough'), (lino_xl.lib.countries.choicelists.PlaceType('62', 'Small borough', 'smallborough'), 'Small borough'), (lino_xl.lib.countries.choicelists.PlaceType('70', 'Village', 'village'), 'Village')], help_text="The type of this place (whether it's a city. a village, a province...)", max_length=10, verbose_name='Place Type')),
                ('show_type', models.BooleanField(default=False, verbose_name='Show type')),
                ('name_de', models.CharField(blank=True, max_length=200, verbose_name='Designation (de)')),
                ('name_fr', models.CharField(blank=True, max_length=200, verbose_name='Designation (fr)')),
                ('country', models.ForeignKey(help_text='The country this place is in.', on_delete=django.db.models.deletion.PROTECT, to='countries.Country')),
                ('parent', models.ForeignKey(blank=True, help_text='The superordinate geographic place of which this place is a part.', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='children', to='countries.Place', verbose_name='Parent')),
            ],
            options={
                'verbose_name': 'Place',
                'verbose_name_plural': 'Places',
                'abstract': False,
                'unique_together': {('country', 'parent', 'name', 'type', 'zip_code')},
            },
            bases=(models.Model, lino.core.fields.TableRow),
        ),
    ]
