Answer the question
In order to leave comments, you need to log in
How to fix already exists error on load data?
I made a dump with sqllite, --exclude auth.permission --exclude contenttypes, everything is as it should be.
I built pgsql on the server, I do load data, and it crashes:
Could not load accounts.UserProfile(pk=1): duplicate key value violates unique constraint "accounts_userprofile_user_id_key"
DETAIL: Key (user_id)=(1) already exists.
class UserProfile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
avatar = models.ImageField(blank=True, upload_to='user_avatar')
...
Answer the question
In order to leave comments, you need to log in
I suspect, but not sure, that when you create the User model, you automatically create a UserProfile on a signal. In general, creating a profile in this way has been outdated for 5-6 years already. It has long been necessary to switch to using your own user model, in which to add the missing fields.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question