diff options
| author | Tom Christie | 2013-02-12 13:53:45 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-02-12 13:53:45 +0000 |
| commit | 388e6173669a295214a718e55dbf467559835dee (patch) | |
| tree | 3052652bef93f69ff9852c8a2a966f493f32c0a6 /rest_framework | |
| parent | f642ee48a666d5cfc3a15cf8c33629bbb6173787 (diff) | |
| download | django-rest-framework-388e6173669a295214a718e55dbf467559835dee.tar.bz2 | |
Raise warnings on implicit many serialization
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/serializers.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 0a2e103f..d59bcfd3 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -344,6 +344,10 @@ class BaseSerializer(Field): many = self.many else: many = hasattr(data, '__iter__') and not isinstance(data, (Page, dict)) + if many: + warnings.warn('Implict list/queryset serialization is due to be deprecated. ' + 'Use the `many=True` flag when instantiating the serializer.', + PendingDeprecationWarning, stacklevel=2) # TODO: error data when deserializing lists if many: @@ -369,6 +373,10 @@ class BaseSerializer(Field): many = self.many else: many = hasattr(obj, '__iter__') and not isinstance(obj, (Page, dict)) + if many: + warnings.warn('Implict list/queryset serialization is due to be deprecated. ' + 'Use the `many=True` flag when instantiating the serializer.', + PendingDeprecationWarning, stacklevel=2) if many: self._data = [self.to_native(item) for item in obj] |
