aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/serializers.py
diff options
context:
space:
mode:
authorJ. Paul Reed2013-04-02 01:41:31 -0700
committerJ. Paul Reed2013-04-02 01:41:40 -0700
commit889558365bb3947ab77f47207381d5ff6316fa4f (patch)
tree3aac2b81c7bb98dca1a51e02ca5e4800986bf736 /rest_framework/serializers.py
parent5ed70324273d8093335f21155975267b22a641d2 (diff)
downloaddjango-rest-framework-889558365bb3947ab77f47207381d5ff6316fa4f.tar.bz2
Don't have the ModelSerializer trust deserialized objects to not have redefine bool()ean-ness.
If the model we're using the ModelSerializer for has redefined methods that act as a boolean (__bool__ or __len__), it may not return the object even though it is_valid(), and should.
Diffstat (limited to 'rest_framework/serializers.py')
-rw-r--r--rest_framework/serializers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py
index 1b2b0821..e28bbe81 100644
--- a/rest_framework/serializers.py
+++ b/rest_framework/serializers.py
@@ -741,7 +741,7 @@ class ModelSerializer(Serializer):
Override the default method to also include model field validation.
"""
instance = super(ModelSerializer, self).from_native(data, files)
- if instance:
+ if not self._errors:
return self.full_clean(instance)
def save_object(self, obj, **kwargs):