Opened 13 years ago

Last modified 13 years ago

#17438 closed Bug

Model names wrong in administrator pages — at Initial Version

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

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 (0)

Note: See TracTickets for help on using tickets.
Back to Top