title: How to use serializer to create a new object with a foreignkey
body: <p>suppose this model:</p>
  
  <pre><code>class Tweek(models.Model):
      content = models.CharField(max_length=140)
      date = models.DateTimeField(auto_now_add=True)
      author = models.ForeignKey(User, related_name='author')
  
      class Meta:
          ordering = ['-date']
  
      def __unicode__(self):
          return self.content
  </code></pre>
  
  <p>Everthing works fine, now i try to bind a rest api uppon. I've installed the django rest framework and I can retrieve tweeks but I cannot create new ones.</p>
  
  <p>I have this serializer for the Tweek model:</p>
  
  <pre><code>class TweekSerializer(serializers.ModelSerializer):
      author = UserSerializer()
  
      class Meta:
          model = Tweek
          fields = ('content', 'date', 'author')
  
      def create(self, validated_data):
          author_data = validated_data.pop('author')
          author = User.objects.get(username=author_data)
  
          return Tweek.objects.create(author=author, **validated_data)
  </code></pre>
  
  <p>and the user serializer somply looks like:</p>
  
  <pre><code>class UserSerializer(serializers.ModelSerializer):
      class Meta:
          model = User
          fields = ('username', 'first_name', 'last_name')
  </code></pre>
  
  <p>but the post returns</p>
  
  <pre><code>{
      "author": {
          "username": [
              "This field must be unique."
          ]
      }
  }
  </code></pre>
  
  <p>I've followed the doc, but i'm lost with this case :(
  Any idea ?</p>