          super(HyperlinkedIdentityField, self).__init__(*args, **kwargs)
  
      def field_to_native(self, obj, field_name):
          request = self.context.get('request', None)
          format = self.format or self.context.get('format', None)
          view_name = self.view_name or self.parent.opts.view_name
          kwargs = {self.pk_url_kwarg: obj.pk}
          try:
              return reverse(view_name, kwargs=kwargs, request=request, format=format)
          except:
 
</s>
        format = self.context.get('format', None)
          super(HyperlinkedIdentityField, self).__init__(*args, **kwargs)
  
      def field_to_native(self, obj, field_name):
          request = self.context.get('request', None)
        format = self.context.get('format', None)
          view_name = self.view_name or self.parent.opts.view_name
          kwargs = {self.pk_url_kwarg: obj.pk}
          try:
              return reverse(view_name, kwargs=kwargs, request=request, format=format)
          except:
keep keep keep keep replace keep keep keep keep keep
 Tweak behavior of hyperlinked fields that include an explicit format suffix.
rest_framework/relations.py