aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorOscar Vilaplana2013-05-19 11:15:38 +0200
committerOscar Vilaplana2013-05-19 11:15:38 +0200
commitb915c1d4d81fc459ed7c79ee5264ef7467963c3f (patch)
tree0ff8a4b2f86adc1f0bf4f924fa6905219c025f0c /rest_framework/fields.py
parent42b61ffcd7dd5091846d884cba34f3a82dcf81f4 (diff)
downloaddjango-rest-framework-b915c1d4d81fc459ed7c79ee5264ef7467963c3f.tar.bz2
Made field label optional in OPTIONS
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index a215e02b..b1bbb4d4 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -136,11 +136,10 @@ def humanize_field(field):
humanized = {
'type': humanize_field_type(field.__class__),
'required': getattr(field, 'required', False),
- 'label': getattr(field, 'label', None),
}
- optional_attrs = ['read_only', 'help_text']
+ optional_attrs = ['read_only', 'help_text', 'label']
for attr in optional_attrs:
- if hasattr(field, attr):
+ if getattr(field, attr, None) is not None:
humanized[attr] = getattr(field, attr)
return humanized