summaryrefslogtreecommitdiff
path: root/django/forms/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/forms/forms.py')
-rw-r--r--django/forms/forms.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/forms/forms.py b/django/forms/forms.py
index 45bbbb41b6..b3718efa9a 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -18,9 +18,10 @@ __all__ = ('BaseForm', 'Form')
NON_FIELD_ERRORS = '__all__'
def pretty_name(name):
- "Converts 'first_name' to 'First name'"
- name = name[0].upper() + name[1:]
- return name.replace('_', ' ')
+ """Converts 'first_name' to 'First name'"""
+ if not name:
+ return u''
+ return name.replace('_', ' ').capitalize()
def get_declared_fields(bases, attrs, with_base_fields=True):
"""