Ticket #12434: pretty_name_complete.diff

File pretty_name_complete.diff, 589 bytes (added by Gabriel Hurley, 15 years ago)

Patches pretty_name to use capitalize() and work with None and/or blank strings as argument.

  • django/forms/forms.py

     
    1818NON_FIELD_ERRORS = '__all__'
    1919
    2020def pretty_name(name):
    21     "Converts 'first_name' to 'First name'"
    22     name = name[0].upper() + name[1:]
    23     return name.replace('_', ' ')
     21    """Converts 'first_name' to 'First name'"""
     22    if not name:
     23        return u''
     24    return name.replace('_', ' ').capitalize()
    2425
    2526def get_declared_fields(bases, attrs, with_base_fields=True):
    2627    """
Back to Top