-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy path0001_initial.py
More file actions
53 lines (47 loc) · 1.96 KB
/
0001_initial.py
File metadata and controls
53 lines (47 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Generated by Django 3.2.8 on 2022-12-22 08:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Food',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
],
options={
'default_related_name': 'foods',
},
),
migrations.CreateModel(
name='Ingredient',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.DecimalField(blank=True, decimal_places=3, max_digits=6, null=True)),
('unit_of_measure', models.CharField(max_length=255)),
('desc', models.TextField()),
('food', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.food')),
],
),
migrations.CreateModel(
name='Recipe',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('desc', models.TextField(blank=True, null=True)),
('instructions', models.TextField(blank=True, null=True)),
('ingredients', models.ManyToManyField(related_name='recipes', through='cookbook.Ingredient', to='cookbook.Food')),
],
options={
'default_related_name': 'recipes',
},
),
migrations.AddField(
model_name='ingredient',
name='recipe',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.recipe'),
),
]