def copy_regulations(apps, schema_editor):
    Regulation = apps.get_model('regcore', 'Regulation')
    Document = apps.get_model('regcore', 'Document')
    for reg in Regulation.objects.all():
        data = {field.name: getattr(reg, field.name) for field in Regulation._meta.fields if (field.name not in {'parent'})}
        doc = Document(doc_type='cfr', **data)
        doc.parent_id = reg.parent_id
        doc.save()
def copy_regulations(apps, schema_editor):
    Regulation = apps.get_model('regcore', 'Regulation')
    Document = apps.get_model('regcore', 'Document')
    for reg in Regulation.objects.all():
        data = {field.name: getattr(reg, field.name) for field in Regulation._meta.fields if (field.name not in {'parent'})}
        doc = Document(doc_type='cfr', **data)
        doc.parent_id = reg.parent_id
        doc.save()