      def to_internal_value(self, data):
          try:
              return self.get_queryset().get(**{self.slug_field: data})
          except ObjectDoesNotExist:
              self.fail('does_not_exist', slug_name=self.slug_field, value=smart_text(data))
          except (TypeError, ValueError):
              self.fail('invalid')
  
      def to_representation(self, obj):
          return getattr(obj, self.slug_field)
 
</s> remove             return self._get_description_section(view, method.lower(), formatting.dedent(smart_text(method_docstring)))
 </s> add             return self._get_description_section(view, method.lower(), formatting.dedent(smart_str(method_docstring))) </s> remove from django.utils.translation import ugettext_lazy as _
 </s> add from django.utils.translation import gettext_lazy as _ </s> remove     description = formatting.dedent(smart_text(description))
 </s> add     description = formatting.dedent(smart_str(description)) </s> remove         data = smart_text(data).strip()
 </s> add         data = smart_str(data).strip() </s> remove from django.utils.encoding import smart_text
 </s> add from django.utils.encoding import smart_str
            self.fail('does_not_exist', slug_name=self.slug_field, value=smart_str(data))
      def to_internal_value(self, data):
          try:
              return self.get_queryset().get(**{self.slug_field: data})
          except ObjectDoesNotExist:
            self.fail('does_not_exist', slug_name=self.slug_field, value=smart_str(data))
          except (TypeError, ValueError):
              self.fail('invalid')
  
      def to_representation(self, obj):
          return getattr(obj, self.slug_field)
keep keep keep keep replace keep keep keep keep keep
 Fix Django 3.0 deprecations (#7074) 
rest_framework/relations.py