X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/e15b74e6d8f736dfc8a6101e8b9c6583eebd7509..74f7584b18b4386433b4c02336f5adafcae530c5:/src/club/migrations/0030_populate_method.py diff --git a/src/club/migrations/0030_populate_method.py b/src/club/migrations/0030_populate_method.py new file mode 100644 index 000000000..40b2cdd67 --- /dev/null +++ b/src/club/migrations/0030_populate_method.py @@ -0,0 +1,23 @@ +# Generated by Django 2.2.19 on 2021-06-18 10:11 + +from django.db import migrations, models + + +def populate_method(apps, schema_editor): + Schedule = apps.get_model('club', 'Schedule') + Schedule.objects.filter(method='', monthly=False, yearly=False).update(method='payu') + Schedule.objects.filter( + models.Q(monthly=True) | models.Q(yearly=True), + method='' + ).update(method='payu-re') + + +class Migration(migrations.Migration): + + dependencies = [ + ('club', '0029_schedule_method'), + ] + + operations = [ + migrations.RunPython(populate_method, migrations.RunPython.noop) + ]