mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
getUserPreference available for all UserPreferences
This commit is contained in:
43
cookbook/migrations/0162_food_inherit.py
Normal file
43
cookbook/migrations/0162_food_inherit.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# Generated by Django 3.2.7 on 2021-10-14 22:36
|
||||
|
||||
import cookbook.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cookbook', '0161_alter_shoppinglistentry_list_recipe'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='FoodParentIgnore',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('field', models.CharField(max_length=32, unique=True)),
|
||||
('name', models.CharField(max_length=64, unique=True)),
|
||||
],
|
||||
bases=(models.Model, cookbook.models.PermissionModelMixin),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='food',
|
||||
name='child_inherit',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='userpreference',
|
||||
name='food_inherit',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='userpreference',
|
||||
name='mealplan_autoinclude_related',
|
||||
field=models.BooleanField(default=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='food',
|
||||
name='ignore_parent',
|
||||
field=models.ManyToManyField(blank=True, related_name='ignore_parent', to='cookbook.FoodParentIgnore'),
|
||||
),
|
||||
]
|
||||
24
cookbook/migrations/0163_create_food_ignore_fields.py
Normal file
24
cookbook/migrations/0163_create_food_ignore_fields.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from cookbook.models import FoodParentIgnore
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def create_ignorefields(apps, schema_editor):
|
||||
FoodParentIgnore.objects.create(name='Supermarket Category', field='name')
|
||||
FoodParentIgnore.objects.create(name='Ignore Shopping', field='ignore_shopping')
|
||||
FoodParentIgnore.objects.create(name='Diet', field='diet')
|
||||
FoodParentIgnore.objects.create(name='Substitute', field='substitute')
|
||||
FoodParentIgnore.objects.create(name='Substitute Children', field='substitute_children')
|
||||
FoodParentIgnore.objects.create(name='Substitute Siblings', field='substitute_siblings')
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cookbook', '0162_food_inherit'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
create_ignorefields
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user