          kwargs['read_only'] = True
          super(StringRelatedField, self).__init__(**kwargs)
  
      def to_representation(self, value):
          return six.text_type(value)
  
  
  class PrimaryKeyRelatedField(RelatedField):
      default_error_messages = {
          'required': _('This field is required.'),
 
</s> remove         super(StringRelatedField, self).__init__(**kwargs)
 </s> add         super().__init__(**kwargs) </s> remove class Field(object):
 </s> add class Field: </s> remove         ))
 </s> add         ) </s> remove class BaseUniqueForValidator(object):
 </s> add class BaseUniqueForValidator: </s> remove         value = six.text_type(data)
 </s> add         value = str(data)
        return str(value)
          kwargs['read_only'] = True
          super(StringRelatedField, self).__init__(**kwargs)
  
      def to_representation(self, value):
        return str(value)
  
  
  class PrimaryKeyRelatedField(RelatedField):
      default_error_messages = {
          'required': _('This field is required.'),
keep keep keep keep replace keep keep keep keep keep
 Dropped Python 2 compatibility. (#6615)

Thanks to Jon Dufresne (@jdufresne) for review.

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com> 
rest_framework/relations.py