title: Not Null constraint failed on Nested serializer due to "unable do get repr for QuerySet class" error
body: <p>Trying to get basic Messaging functionality working in my DRF project. I seem to have a problem with the nested serializer validation. I'm new to DRF and have been reading the docs for a few days but I must have missed something.</p>
  
  <p>The error happens inside the line         <code>message = Message.objects.create(**validated_data)</code> in my serializer.The request returns an <code>Integrity error, NOT NULL constraint failed on accounts_message.sender_id</code>, but through debugging I have found that this is caused by an error in query.py in the QuerySet method : <code>self: unable to get repr for &lt;class 'django.db.models.query.QuerySet'&gt; model: &lt;class 'accounts.models.Message'&gt; query: none using: none</code></p>
  
  <p>This seems to be whats causing my issue, since the dict generated by the serializer seems to have all of the data thats being passed in the request, including the supposed null sender_id. However, I am not sure how to fix this issue. Do I need to override repr? or Query Set? This feels like im stuck on something relatively simple.</p>
  
  <p><strong>Serializers.py</strong></p>
  
  <pre><code>class UserSerializer(serializers.ModelSerializer):
      class Meta:
          model = User
          fields = ('id', 'name', 'email')
          extra_kwargs = {
              'id': {
                  'validators': [UnicodeUsernameValidator()],
              }
          }
  
  class MessageSerializer(serializers.ModelSerializer):
      sender = UserSerializer()
      recipients = UserSerializer(many=True)
  
  
      class Meta:
          model = Message
          fields = ('id', 'subject', 'body', 'read', 'sender', 'recipients')
  
  
      def create(self, validated_data):
          sender_data = validated_data.pop('sender')
          recipient_data = validated_data.pop('recipients')
          message = Message.objects.create(**validated_data)
  
          for user in recipient_data:
              user= User.message_recip.get_or_create(id=user['id'], name=user['name'])
              message.recipients.add(user)
  
          for user in sender_data:
              user= User.objects.get_or_create(id=user['id'], name=user['name'])
              message.sender.add(user)
          return message
  </code></pre>
  
  <p><strong>Models.py</strong></p>
  
  <pre><code>from django.db import models
  
  class User(models.Model):
      id = models.IntegerField(primary_key=True)
      name = models.CharField(max_length=30)
      email = models.CharField(max_length=75)
  
      def __str__(self):
          return self.name
  
  class Message(models.Model):
      id = models.IntegerField(primary_key=True)
      subject = models.CharField(max_length=250)
      body = models.CharField(max_length=5000)
      read = models.BooleanField(default=False)
      sender = models.ForeignKey(User, related_name='message_sender')
  
      recipients = models.ForeignKey(User, related_name='message_recip', default=1)
  </code></pre>
  
  <p><strong>Views.py</strong></p>
  
  <pre><code>class MessageList(APIView):
  
      def get(self, request):
          messages = Message.objects.all()
          serializer = MessageSerializer(messages, many=True)
          return Response(serializer.data)
  
      def post(self, request):
          serializer = MessageSerializer(data=request.data)
          if serializer.is_valid():
              serializer.save()
              return Response(serializer.data, status=status.HTTP_201_CREATED)
          return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
  
  
  class User(APIView):
  
      def get(self, request):
          user = User.objects.get(id)
          serializer = UserSerializer(user, many=False)
          return Response(serializer.data)
  </code></pre>