Improved nested update test in update().

Closes #2194.
This commit is contained in:
Tom Christie 2014-12-03 22:43:40 +00:00
parent 71a8cb2282
commit f2dd05a6e6

View File

@ -681,8 +681,8 @@ class ModelSerializer(Serializer):
def update(self, instance, validated_attrs): def update(self, instance, validated_attrs):
assert not any( assert not any(
isinstance(field, BaseSerializer) and not field.read_only isinstance(field, BaseSerializer) and (key in validated_attrs)
for field in self.fields.values() for key, field in self.fields.values()
), ( ), (
'The `.update()` method does not suport nested writable fields ' 'The `.update()` method does not suport nested writable fields '
'by default. Write an explicit `.update()` method for serializer ' 'by default. Write an explicit `.update()` method for serializer '