diff options
| author | Brian Zambrano | 2013-05-13 10:51:51 -0700 | 
|---|---|---|
| committer | Brian Zambrano | 2013-05-13 14:41:12 -0700 | 
| commit | 24c9c455feaa47487196a2c9343746d7d5bdd962 (patch) | |
| tree | bd3f067bb45d712a8287256b8f5383144e3902fa /rest_framework/fields.py | |
| parent | 1154d873e956e89b1b994c3ac803d90cbfcedf59 (diff) | |
| download | django-rest-framework-24c9c455feaa47487196a2c9343746d7d5bdd962.tar.bz2 | |
Allow for missing non-required nested objects.
Serializer fields which are themselves serializers should not be required.
Specifically, if a nested object is set to "required=False", it should be
possible to serialize the main object and have the sub-object set to None/null.
Diffstat (limited to 'rest_framework/fields.py')
| -rw-r--r-- | rest_framework/fields.py | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/rest_framework/fields.py b/rest_framework/fields.py index c83ee5ec..1f38b795 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -50,7 +50,7 @@ def get_component(obj, attr_name):      return that attribute on the object.      """      if isinstance(obj, dict): -        val = obj[attr_name] +        val = obj.get(attr_name)      else:          val = getattr(obj, attr_name) | 
