mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #12434: Made pretty_name handle empty string and None as input. Thanks ales_zoulek and gabrielhurley.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12794 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user