Merge branch 'develop' into recipe-serving-count

This commit is contained in:
vabene1111
2020-12-28 10:19:52 +01:00
committed by GitHub
59 changed files with 12191 additions and 5803 deletions

View File

@@ -0,0 +1,26 @@
# Generated by Django 3.1.4 on 2020-12-26 14:51
from django.db import migrations
def migrate_empty_units(apps, schema_editor):
Unit = apps.get_model('cookbook', 'Unit')
Ingredient = apps.get_model('cookbook', 'Ingredient')
empty_units = Unit.objects.filter(name='').all()
for x in empty_units:
for i in Ingredient.objects.all():
if i.unit == x:
i.unit = None
i.save()
x.delete()
class Migration(migrations.Migration):
dependencies = [
('cookbook', '0090_auto_20201214_1359'),
]
operations = [
migrations.RunPython(migrate_empty_units),
]