From 0cf88368324ef5c1dcc6fc12fe286f21456876e7 Mon Sep 17 00:00:00 2001 From: Adarnof Date: Fri, 22 Dec 2017 11:32:45 -0500 Subject: [PATCH] Use primary key for FK assignment --- allianceauth/authentication/migrations/0015_user_profiles.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/allianceauth/authentication/migrations/0015_user_profiles.py b/allianceauth/authentication/migrations/0015_user_profiles.py index f77d3f5a..5f57fba6 100644 --- a/allianceauth/authentication/migrations/0015_user_profiles.py +++ b/allianceauth/authentication/migrations/0015_user_profiles.py @@ -111,7 +111,8 @@ def populate_ownerships(apps, schema_editor): ts = tokens.filter(character_id=c_id).exclude(refresh_token__isnull=True).order_by('created') if ts.exists(): token = ts[0] - CharacterOwnership.objects.create(user_id=token.user_id, character_id=token.character_id, owner_hash=token.character_owner_hash) + char = EveCharacter.objects.get(character_id=token.character_id) + CharacterOwnership.objects.create(user_id=token.user_id, character_id=char.id, owner_hash=token.character_owner_hash) def create_profiles(apps, schema_editor):