cookbook/recipes/migrations/0001_initial.py

44 lines
1.5 KiB
Python
Raw Permalink Normal View History

2019-10-28 16:50:13 +01:00
# Generated by Django 2.2.6 on 2019-10-25 12:09
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Ingredient',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128)),
],
),
migrations.CreateModel(
name='IngredientUsage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('quantity', models.CharField(max_length=64)),
('ingredient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recipes.Ingredient')),
],
),
migrations.CreateModel(
name='Recipe',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128)),
('ingredients', models.ManyToManyField(through='recipes.IngredientUsage', to='recipes.Ingredient')),
],
),
migrations.AddField(
model_name='ingredientusage',
name='recipe',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recipes.Recipe'),
),
]