Ticket #1884: get_verbose_name.patch

File get_verbose_name.patch, 611 bytes (added by Alex Dedul, 19 years ago)

get_verbose_name patch

  • options.py

     
    99import re
    1010
    1111# Calculate the verbose_name by converting from InitialCaps to "lowercase with spaces".
    12 get_verbose_name = lambda class_name: re.sub('([A-Z])', ' \\1', class_name).lower().strip()
     12get_verbose_name = lambda class_name: re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', ' \\1', class_name).lower().strip()
    1313
    1414DEFAULT_NAMES = ('verbose_name', 'db_table', 'ordering',
    1515                 'unique_together', 'permissions', 'get_latest_by',
Back to Top