          return BlogPostComment(**attrs)
  
  
  class BasicList(generics.ListCreateAPIView):
      model = BasicModel
      model_serializer_class = serializers.HyperlinkedModelSerializer
  
 
</s> remove     url(r'^comments/$', BlogPostCommentListCreate.as_view(), name='blogpostcomment-list')
 </s> add     url(r'^comments/$', BlogPostCommentListCreate.as_view(), name='blogpostcomment-list'),
    url(r'^albums/(?P<title>\w[\w-]*)/$', AlbumDetail.as_view(), name='album-detail'),
    url(r'^photos/$', PhotoListCreate.as_view(), name='photo-list') </s> remove from rest_framework.tests.models import Anchor, BasicModel, ManyToManyModel, BlogPost, BlogPostComment
 </s> add from rest_framework.tests.models import Anchor, BasicModel, ManyToManyModel, BlogPost, BlogPostComment, Album, Photo
class PhotoSerializer(serializers.Serializer):
    description = serializers.CharField()
    album_url = serializers.HyperlinkedRelatedField(source='album', view_name='album-detail', queryset=Album.objects.all(), slug_field='title', slug_url_kwargs='title')

    def restore_object(self, attrs, instance=None):
        return Photo(**attrs)


          return BlogPostComment(**attrs)
  
  
class PhotoSerializer(serializers.Serializer):
    description = serializers.CharField()
    album_url = serializers.HyperlinkedRelatedField(source='album', view_name='album-detail', queryset=Album.objects.all(), slug_field='title', slug_url_kwargs='title')

    def restore_object(self, attrs, instance=None):
        return Photo(**attrs)


  class BasicList(generics.ListCreateAPIView):
      model = BasicModel
      model_serializer_class = serializers.HyperlinkedModelSerializer
  
keep keep add keep keep keep keep
 added testcase for custom slug field in hyperlinkedrelatedfield 
rest_framework/tests/hyperlinkedserializers.py