# Generated by Django 3.2.5 on 2021-07-21 11:29

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='CAP',
            fields=[
                ('codice', models.CharField(max_length=5, primary_key=True, serialize=False)),
            ],
            options={
                'verbose_name': 'CAP',
                'verbose_name_plural': 'CAP',
            },
        ),
        migrations.CreateModel(
            name='Regione',
            fields=[
                ('nome', models.CharField(blank=True, default='', max_length=32, primary_key=True, serialize=False)),
            ],
            options={
                'verbose_name': 'Regione',
                'verbose_name_plural': 'Regioni',
                'ordering': ('nome',),
            },
        ),
        migrations.CreateModel(
            name='Provincia',
            fields=[
                ('sigla', models.CharField(max_length=2, primary_key=True, serialize=False)),
                ('nome_esteso', models.CharField(max_length=50)),
                ('regione', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='province', to='dati_geo_app.regione')),
            ],
            options={
                'verbose_name': 'Provincia',
                'verbose_name_plural': 'Province',
                'ordering': ('nome_esteso',),
            },
        ),
        migrations.CreateModel(
            name='Comune',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nome', models.CharField(max_length=60)),
                ('codice_istat', models.CharField(max_length=6)),
                ('codice_nazionale', models.CharField(max_length=4)),
                ('cap', models.ManyToManyField(related_name='comuni', to='dati_geo_app.CAP')),
                ('provincia', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='comuni', to='dati_geo_app.provincia')),
            ],
            options={
                'verbose_name': 'Comune',
                'verbose_name_plural': 'Comuni',
                'ordering': ('nome', 'provincia_id'),
                'unique_together': {('nome', 'provincia')},
            },
        ),
    ]
