diff --git a/cookbook/migrations/0166_alter_userpreference_shopping_add_onhand.py b/cookbook/migrations/0166_alter_userpreference_shopping_add_onhand.py new file mode 100644 index 00000000..2ae2352c --- /dev/null +++ b/cookbook/migrations/0166_alter_userpreference_shopping_add_onhand.py @@ -0,0 +1,26 @@ +# Generated by Django 3.2.11 on 2022-01-20 14:39 + +from django.db import migrations, models +from django_scopes import scopes_disabled + + +def add_default_trigram(apps, schema_editor): + with scopes_disabled(): + UserPreference = apps.get_model('cookbook', 'UserPreference') + + UserPreference.objects.all().update(shopping_add_onhand=False) + + +class Migration(migrations.Migration): + dependencies = [ + ('cookbook', '0165_remove_step_type'), + ] + + operations = [ + migrations.AlterField( + model_name='userpreference', + name='shopping_add_onhand', + field=models.BooleanField(default=False), + ), + migrations.RunPython(add_default_trigram), + ] diff --git a/cookbook/models.py b/cookbook/models.py index df6ec226..cccf0996 100644 --- a/cookbook/models.py +++ b/cookbook/models.py @@ -337,7 +337,7 @@ class UserPreference(models.Model, PermissionModelMixin): mealplan_autoadd_shopping = models.BooleanField(default=False) mealplan_autoexclude_onhand = models.BooleanField(default=True) mealplan_autoinclude_related = models.BooleanField(default=True) - shopping_add_onhand = models.BooleanField(default=True) + shopping_add_onhand = models.BooleanField(default=False) filter_to_supermarket = models.BooleanField(default=False) default_delay = models.DecimalField(default=4, max_digits=8, decimal_places=4) shopping_recent_days = models.PositiveIntegerField(default=7)