diff options
| author | Tom Christie | 2014-10-15 15:13:28 +0100 | 
|---|---|---|
| committer | Tom Christie | 2014-10-15 15:13:28 +0100 | 
| commit | b4f3379c7002f0c80a26605fdd9c69d7cef2f16f (patch) | |
| tree | 2a4939cc2c46c9fdfab4284ec29aa9be8925d710 /rest_framework/fields.py | |
| parent | e8ea365c15b13185efc2ba03e57a3302f783d538 (diff) | |
| download | django-rest-framework-b4f3379c7002f0c80a26605fdd9c69d7cef2f16f.tar.bz2 | |
Support fields that reference a simple callable
Diffstat (limited to 'rest_framework/fields.py')
| -rw-r--r-- | rest_framework/fields.py | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/rest_framework/fields.py b/rest_framework/fields.py index b881ad13..24dfaaf5 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -66,6 +66,8 @@ def get_attribute(instance, attrs):                  return instance[attr]              except (KeyError, TypeError, AttributeError):                  raise exc +    if is_simple_callable(instance): +        return instance()      return instance @@ -1025,8 +1027,6 @@ class ReadOnlyField(Field):          super(ReadOnlyField, self).__init__(**kwargs)      def to_representation(self, value): -        if is_simple_callable(value): -            return value()          return value | 
