  
  
  class BlogPostCommentSerializer(serializers.Serializer):
      text = serializers.CharField()
      blog_post_url = serializers.HyperlinkedRelatedField(source='blog_post', view_name='blogpost-detail', queryset=BlogPost.objects.all())
  
      def restore_object(self, attrs, instance=None):
          return BlogPostComment(**attrs)
  
  
 
</s> remove class BlogPostCommentSerializer(serializers.Serializer):
 </s> add class BlogPostCommentSerializer(serializers.ModelSerializer): </s> remove     def restore_object(self, attrs, instance=None):
        return BlogPostComment(**attrs)
 </s> add     class Meta:
        model = BlogPostComment
        fields = ('text', 'blog_post_url') </s> remove                 field.initialize(parent=self)
 </s> add                 field.initialize(parent=self, field_name=model_field.name) </s> remove         self.fields = copy.deepcopy(self.base_fields)
 </s> add 
    blog_post_url = serializers.HyperlinkedRelatedField(source='blog_post', view_name='blogpost-detail')
  
  
  class BlogPostCommentSerializer(serializers.Serializer):
      text = serializers.CharField()
    blog_post_url = serializers.HyperlinkedRelatedField(source='blog_post', view_name='blogpost-detail')
  
      def restore_object(self, attrs, instance=None):
          return BlogPostComment(**attrs)
  
  
keep keep keep keep replace keep keep keep keep keep
 `queryset` argument is now optional on writable model fields. 
rest_framework/tests/hyperlinkedserializers.py