diff options
| author | Tom Christie | 2012-10-18 22:02:44 +0100 |
|---|---|---|
| committer | Tom Christie | 2012-10-18 22:03:48 +0100 |
| commit | d1746e2f3c3c2250ffdf7b71f2a77df3edccea61 (patch) | |
| tree | 275f4df74c489e241dc117ad7eb342116bd78838 /rest_framework | |
| parent | 0c65d9babee24f7c772dde2fc98ea4fdcb2ab6aa (diff) | |
| download | django-rest-framework-d1746e2f3c3c2250ffdf7b71f2a77df3edccea61.tar.bz2 | |
Allow callables in dotted notation like Field(source='foo.bar')
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/fields.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py index bb9a523d..663a168d 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -70,6 +70,8 @@ class Field(object): value = obj for component in self.source.split('.'): value = getattr(value, component) + if is_simple_callable(value): + value = value() else: value = getattr(obj, field_name) return self.to_native(value) |
