diff options
| author | Tom Christie | 2012-11-22 02:05:46 -0800 |
|---|---|---|
| committer | Tom Christie | 2012-11-22 02:05:46 -0800 |
| commit | ba553b7dcdb232079cb04e6d7cd673d39cc99695 (patch) | |
| tree | 4ba4c0cceea3ca001665560619313aed1c9624b8 /docs | |
| parent | b0bad35ef0972ec26ff808d81b1f43f16683898d (diff) | |
| parent | 0876bed96304c3c2125e0de67736d40bfe921cf7 (diff) | |
| download | django-rest-framework-ba553b7dcdb232079cb04e6d7cd673d39cc99695.tar.bz2 | |
Merge pull request #438 from maspwr/partial-update
Add support for partial serializer updates
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api-guide/serializers.md | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index 048c1200..19efde3c 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -77,6 +77,10 @@ When deserializing data, we can either create a new instance, or update an exist serializer = CommentSerializer(data=data) # Create new instance serializer = CommentSerializer(comment, data=data) # Update `instance` +By default, serializers must be passed values for all required fields or they will throw validation errors. You can use the `partial` argument in order to allow partial updates. + + serializer = CommentSerializer(comment, data={'content': u'foo bar'}, partial=True) # Update `instance` with partial data + ## Validation When deserializing data, you always need to call `is_valid()` before attempting to access the deserialized object. If any validation errors occur, the `.errors` and `.non_field_errors` properties will contain the resulting error messages. |
