From b915c1d4d81fc459ed7c79ee5264ef7467963c3f Mon Sep 17 00:00:00 2001 From: Oscar Vilaplana Date: Sun, 19 May 2013 11:15:38 +0200 Subject: Made field label optional in OPTIONS --- rest_framework/fields.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'rest_framework') 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 -- cgit v1.2.3