Reputation: 12361
I have an existing model in which I want to add a User foreign key ex:
user = models.ForeignKey(User, unique=False)
If I set the parameter default=User.admin
I get an attribute error.
If I try to set default=User.objects.get(username='admin')
I get the error ValueError: Cannot serialize: <User: admin>
How can I set the default to be the User
named admin
or any other user?
Upvotes: 1
Views: 2334
Reputation: 25659
Did you try setting primary key? The user table uses integers for the primary key.
Upvotes: 1