aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework
diff options
context:
space:
mode:
authorTom Christie2013-02-12 13:53:45 +0000
committerTom Christie2013-02-12 13:53:45 +0000
commit388e6173669a295214a718e55dbf467559835dee (patch)
tree3052652bef93f69ff9852c8a2a966f493f32c0a6 /rest_framework
parentf642ee48a666d5cfc3a15cf8c33629bbb6173787 (diff)
downloaddjango-rest-framework-388e6173669a295214a718e55dbf467559835dee.tar.bz2
Raise warnings on implicit many serialization
Diffstat (limited to 'rest_framework')
-rw-r--r--rest_framework/serializers.py8
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]