fix migration, only works like that

previous code gave:

ValueError: Cannot assign "<User: joedoe>": "UserProfile.user" must be a "User" instance.
This commit is contained in:
Thomas Waldmann 2014-11-26 00:23:52 +01:00
parent dbfded9e86
commit 202d3bc2dd

View File

@ -6,7 +6,7 @@ from django.contrib.auth import get_user_model
def add_userprofiles(apps, schema_editor):
User = get_user_model()
User = apps.get_model("auth", "User")
UserProfile = apps.get_model("accounts", "UserProfile")
for user in User.objects.all():
UserProfile.objects.get_or_create(user=user)