  
          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
  
 
</s> remove         self.format = kwargs.pop('format', None)
 </s> add  </s> remove         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)

        if request is None:
            warnings.warn("Using `HyperlinkedRelatedField` without including the "
                          "request in the serializer context is deprecated. "
                          "Add `context={'request': request}` when instantiating the serializer.",
                          DeprecationWarning, stacklevel=4)
 </s> add         Given an object, return the URL that hyperlinks to the object. </s> remove         self.pk_url_kwarg = kwargs.pop('pk_url_kwarg', self.pk_url_kwarg)
 </s> add  </s> remove         pk = match.kwargs.get(self.pk_url_kwarg, None)
        slug = match.kwargs.get(self.slug_url_kwarg, None)

        # Try explicit primary key.
        if pk is not None:
            queryset = self.queryset.filter(pk=pk)
        # Next, try looking up by slug.
        elif slug is not None:
            slug_field = self.get_slug_field()
            queryset = self.queryset.filter(**{slug_field: slug})
        # If none of those are defined, it's probably a configuation error.
        else:
            raise ValidationError(self.error_messages['configuration_error'])

 </s> add 
    def get_url(self, obj, view_name, request, format):
  
          self.format = kwargs.pop('format', None)
          super(HyperlinkedRelatedField, self).__init__(*args, **kwargs)
  
    def get_url(self, obj, view_name, request, format):
          """
          Get the name of a slug field to be used to look up by slug.
          """
          return self.slug_field
  
keep keep keep keep replace keep keep keep keep keep
 lookup_field on hyperlinked fields, and overriddable hyperlinked fields.  Closes #688 
rest_framework/relations.py