def migrate_invoiced(apps, schema_editor):
    Event = apps.get_model('workshops', 'Event')

    # null → 'unknown'
    Event.objects.filter(invoiced__isnull=True) \
        .update(invoice_status='unknown')
    # true → 'invoiced'
    Event.objects.filter(invoiced=True) \
        .update(invoice_status='invoiced')
    # false → 'invoiced'
    Event.objects.filter(invoiced=False) \
        .update(invoice_status='not-invoiced')
Migrate `invoiced` bool field into `invoice_status` text field.
dataset/ETHPy150Open swcarpentry/amy/workshops/migrations/0040_invoice_status.py/migrate_invoiced