      form_field_class = forms.ChoiceField
  
      default_error_messages = {
          'does_not_exist': _("Invalid pk '%s' - object does not exist."),
          'invalid': _('Invalid value.'),
      }
  
      # TODO: Remove these field hacks...
      def prepare_value(self, obj):
          return self.to_native(obj.pk)
 
</s> remove         'invalid': _('Invalid value.'),
 </s> add         'incorrect_type': _('Incorrect type.  Expected pk value, received %s.'), </s> remove         'invalid': _('Invalid value.'),
 </s> add         'incorrect_type': _('Incorrect type.  Expected url string, received %s.'), </s> remove             msg = self.error_messages['invalid']
            raise ValidationError(msg)
 </s> add             msg = self.error_messages['incorrect_type']
            raise ValidationError(msg % type(value).__name__) </s> remove         serializer = NullableSlugSourceSerializer(data=data)
 </s> add         serializer = NullableForeignKeySourceSerializer(data=data)
        'incorrect_type': _('Incorrect type.  Expected pk value, received %s.'),
      form_field_class = forms.ChoiceField
  
      default_error_messages = {
          'does_not_exist': _("Invalid pk '%s' - object does not exist."),
        'incorrect_type': _('Incorrect type.  Expected pk value, received %s.'),
      }
  
      # TODO: Remove these field hacks...
      def prepare_value(self, obj):
          return self.to_native(obj.pk)
keep keep keep keep replace keep keep keep keep keep
 Raise Validation Errors when relationships receive incorrect types. Fixes #590. 
rest_framework/relations.py