          self.slug_field = kwargs.pop('slug_field', self.slug_field)
          self.format = kwargs.pop('format', None)
          super(HyperlinkedRelatedField, self).__init__(*args, **kwargs)
  
      def to_native(self, obj):
          view_name = self.view_name
          request = self.context.get('request', None)
          format = self.format or self.context.get('format', None)
 
</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
    def get_slug_field(self):
        """
        Get the name of a slug field to be used to look up by slug.
        """
        return self.slug_field

          self.slug_field = kwargs.pop('slug_field', self.slug_field)
          self.format = kwargs.pop('format', None)
          super(HyperlinkedRelatedField, self).__init__(*args, **kwargs)
  
    def get_slug_field(self):
        """
        Get the name of a slug field to be used to look up by slug.
        """
        return self.slug_field

      def to_native(self, obj):
          view_name = self.view_name
          request = self.context.get('request', None)
          format = self.format or self.context.get('format', None)
keep keep keep add keep keep keep keep
 added testcase for custom slug field in hyperlinkedrelatedfield 
rest_framework/fields.py