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:
parent
dbfded9e86
commit
202d3bc2dd
@ -6,7 +6,7 @@ from django.contrib.auth import get_user_model
|
|||||||
|
|
||||||
|
|
||||||
def add_userprofiles(apps, schema_editor):
|
def add_userprofiles(apps, schema_editor):
|
||||||
User = get_user_model()
|
User = apps.get_model("auth", "User")
|
||||||
UserProfile = apps.get_model("accounts", "UserProfile")
|
UserProfile = apps.get_model("accounts", "UserProfile")
|
||||||
for user in User.objects.all():
|
for user in User.objects.all():
|
||||||
UserProfile.objects.get_or_create(user=user)
|
UserProfile.objects.get_or_create(user=user)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user