Add basic login.
[wolnelektury.git] / src / pz / migrations / 0008_fill_cancelled_date.py
1 # Generated by Django 2.2.19 on 2021-10-14 09:01
2
3 from django.db import migrations
4 from django.utils.timezone import now
5
6
7 def fill_cancelled_date(apps, schema_editor):
8     DirectDebit = apps.get_model('pz', 'DirectDebit')
9     DirectDebit.objects.filter(is_cancelled=True).update(
10         cancelled_at=now()
11     )
12
13
14 def fill_is_cancelled(apps, schema_editor):
15     DirectDebit = apps.get_model('pz', 'DirectDebit')
16     DirectDebit.objects.exclude(cancelled_at=None).update(
17         is_cancelled=True
18     )
19
20
21 class Migration(migrations.Migration):
22
23     dependencies = [
24         ('pz', '0007_auto_20211014_1100'),
25     ]
26
27     operations = [
28         migrations.RunPython(
29             fill_cancelled_date,
30             fill_is_cancelled
31         )
32     ]