diff --git a/funders/migrations/0010_repopulate_funder_orgs.py b/funders/migrations/0010_repopulate_funder_orgs.py index e8cba9d1e7bf9ab3dfc18415da192685d6aa9918..6810dc122155b68aad1a10b95943814cb898eee3 100644 --- a/funders/migrations/0010_repopulate_funder_orgs.py +++ b/funders/migrations/0010_repopulate_funder_orgs.py @@ -9,7 +9,7 @@ def repopulate_organization_field(apps, schema_editor): Funder = apps.get_model('funders', 'Funder') Organization = apps.get_model('organizations', 'Organization') - for funder in Funder.objects.all(): + for funder in Funder.objects.filter(organization__isnull=False): funder.org = Organization.objects.get(name=funder.organization.name) funder.save() diff --git a/journals/migrations/0039_repopulate_orgs.py b/journals/migrations/0039_repopulate_orgs.py index cfdd1c8c6a07acc3a74b16e5d5156aa037c2da58..6f600059958dffac010327510eaf760d83fdc089 100644 --- a/journals/migrations/0039_repopulate_orgs.py +++ b/journals/migrations/0039_repopulate_orgs.py @@ -10,7 +10,7 @@ def repopulate_organization_field(apps, schema_editor): PublicationAuthorsTable = apps.get_model('journals', 'PublicationAuthorsTable') Organization = apps.get_model('organizations', 'Organization') - for frac in OrgPubFraction.objects.all(): + for frac in OrgPubFraction.objects.filter(organization__isnull=False): frac.org = Organization.objects.get(name=frac.organization.name) frac.save() diff --git a/partners/migrations/0015_repopulate_partner_orgs.py b/partners/migrations/0015_repopulate_partner_orgs.py index d64f0d5bdd55db2edf1ebb03d72442ec932e0435..3d1ba3076b647d41da4945cb2ff548e69108e7bd 100644 --- a/partners/migrations/0015_repopulate_partner_orgs.py +++ b/partners/migrations/0015_repopulate_partner_orgs.py @@ -9,7 +9,7 @@ def repopulate_organization_field(apps, schema_editor): Partner = apps.get_model('partners', 'Partner') Organization = apps.get_model('organizations', 'Organization') - for partner in Partner.objects.all(): + for partner in Partner.objects.filter(organization__isnull=False): partner.org = Organization.objects.get(name=partner.organization.name) partner.save()