Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Update migration file

Roland Geidere9cca4198aea
diff --git a/wger/nutrition/migrations/0002_auto_20170101_1538.py b/wger/nutrition/migrations/0002_auto_20170101_1538.py
index b71c78c92..875c4a44e 100644
--- a/wger/nutrition/migrations/0002_auto_20170101_1538.py
+++ b/wger/nutrition/migrations/0002_auto_20170101_1538.py
@@ -16,6 +16,13 @@ def copy_username(apps, schema_editor):
ingredient.license_author = 'wger.de'
ingredient.save()
+def update_status(apps, schema_editor):
+ '''
+ Updates the status of the ingredients
+ '''
+ Ingredient = apps.get_model("nutrition", "Ingredient")
+ Ingredient.objects.filter(status__in=('5', '4')).update(status=1)
+
class Migration(migrations.Migration):
dependencies = [
@@ -34,6 +41,7 @@ class Migration(migrations.Migration):
field=models.IntegerField(blank=True, editable=False, verbose_name='Order'),
),
migrations.RunPython(copy_username, reverse_code=migrations.RunPython.noop),
+ migrations.RunPython(update_status, reverse_code=migrations.RunPython.noop),
migrations.RemoveField(
model_name='ingredient',
name='user',