diff options
| author | Tom Christie | 2012-12-29 13:19:05 +0000 |
|---|---|---|
| committer | Tom Christie | 2012-12-29 13:19:05 +0000 |
| commit | 923f81d26971510c12cb08e3061c7b37c0c6ffe8 (patch) | |
| tree | f49cc1a76ecd4873dbeac437f5af0bd950241745 /rest_framework/serializers.py | |
| parent | 250a7231d3b5e44bc5ff984ef9fd515bfd238a25 (diff) | |
| download | django-rest-framework-923f81d26971510c12cb08e3061c7b37c0c6ffe8.tar.bz2 | |
Nested serializers now support nullable relationships, plus test. Fixes #384
Diffstat (limited to 'rest_framework/serializers.py')
| -rw-r--r-- | rest_framework/serializers.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 8156bc18..d8350f95 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -307,6 +307,9 @@ class BaseSerializer(Field): if is_simple_callable(getattr(obj, 'all', None)): return [self.to_native(item) for item in obj.all()] + if obj is None: + return None + return self.to_native(obj) @property |
