# Generated by Django 2.1.7 on 2019-03-29 13:03

import datetime
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('constructor', '0002_auto_20190328_1924'),
    ]

    operations = [
        migrations.CreateModel(
            name='IngredientAmount',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('fixed_price', models.DecimalField(decimal_places=2, max_digits=8, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])),
                ('amount', models.IntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)])),
                ('ingredient', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ingredient_amounts', to='constructor.Ingredient')),
            ],
        ),
        migrations.CreateModel(
            name='PizzaOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dough', models.CharField(choices=[('B', 'Black'), ('W', 'White')], default='W', max_length=1)),
                ('customer_name', models.CharField(max_length=64)),
                ('phone_number', models.CharField(max_length=16, validators=[django.core.validators.RegexValidator(message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.", regex='^\\+?\\d{9,15}$')])),
                ('email', models.EmailField(max_length=254)),
                ('order_price', models.DecimalField(decimal_places=2, max_digits=8, validators=[django.core.validators.MinValueValidator(Decimal('0.01'))])),
                ('date_created', models.DateTimeField(default=datetime.datetime.now)),
                ('date_confirmed', models.DateTimeField(null=True)),
                ('ingredients', models.ManyToManyField(related_name='pizza_orders', through='constructor.IngredientAmount', to='constructor.Ingredient')),
            ],
        ),
        migrations.AddField(
            model_name='ingredientamount',
            name='pizza_order',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='ingredient_amounts', to='constructor.PizzaOrder'),
        ),
    ]
