aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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