DEV Community

Vicente Antonio G. Reyes
Vicente Antonio G. Reyes

Posted on

django.db.utils.IntegrityError: UNIQUE constraint failed: accounts_profile.user_id

I'm having issues with registering a user in my project. I have a custom serializer that inherits from the RegisterView of dj_rest_auth. My code is:

class ProfileDetail(APIView)
    def get_object(self, pk):
            return Profile.objects.get(pk=pk)
        except Profile.DoesNotExist:
            raise Http404

    def get(self, request, pk, format=None):
        profile = self.get_object(pk)
        serializer = ProfileSerializer(profile)

Top comments (0)