[Django]-Column user_id is not unique, with Django UserProfiles

5👍

There are two attempts to create the same profile. One from the signal and one directly from the inlined admin form.

This question/answer covers it and a potential solution in more detail.

0👍

Perhaps check to see if this is a signal for creating a user. You may be seeing a race condition with a number of callbacks.

def create_user_profile(sender, instance, created, **kwargs):
    if created:
        UserProfile.objects.get_or_create(user=instance)

Leave a comment