Opened 13 years ago

Last modified 13 years ago

#17438 closed Bug

Model names wrong in administrator pages — at Version 1

Reported by: pszabady@… Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Gabriel Hurley)

If the model name is SERVER_CONFIG then "Server r_config" will be displayed in the admin interface.

Bad line: django\db\models\options.py(20):

get_verbose_name = lambda class_name: re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', ' \\1', class_name).lower().strip()

Reproduce in python prompt:

>>> import re
>>> e =  re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', ' \\1', "server_config").lower().strip()
>>> print e
server_config
>>> e =  re.sub('(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))', ' \\1', "SERVER_CONFIG").lower().strip()
>>> print e
serve r_config

Fix:

get_verbose_name = lambda class_name: class_name.lower().replace("_"," ")

Best regards,

Peter Szabady

Change History (1)

comment:1 by Gabriel Hurley, 13 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top