mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
make on_hand multiuser
This commit is contained in:
41
cookbook/migrations/0163_auto_20220105_0758.py
Normal file
41
cookbook/migrations/0163_auto_20220105_0758.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Generated by Django 3.2.10 on 2022-01-05 13:58
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
from cookbook.models import FoodInheritField
|
||||
|
||||
|
||||
def rename_inherit_field(apps, schema_editor):
|
||||
x = FoodInheritField.objects.filter(name='On Hand', field='food_onhand').first()
|
||||
if x:
|
||||
x.name = "Ignore Shopping"
|
||||
x.field = "ignore_shopping"
|
||||
x.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('cookbook', '0162_userpreference_csv_delim'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='food',
|
||||
name='onhand_users',
|
||||
field=models.ManyToManyField(blank=True, to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='userpreference',
|
||||
name='shopping_add_onhand',
|
||||
field=models.BooleanField(default=True),
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='food',
|
||||
old_name='food_onhand',
|
||||
new_name='ignore_shopping',
|
||||
),
|
||||
migrations.RunPython(rename_inherit_field),
|
||||
]
|
||||
Reference in New Issue
Block a user