Code

Opened 2 years ago

Closed 2 years ago

Last modified 15 months ago

#18129 closed Cleanup/optimization (wontfix)

Capitalization of verbose_name bad design decision. Why waste computer power.

Reported by: anonymous Owned by: nobody
Component: Uncategorized Version: 1.4
Severity: Normal Keywords: capitalize verbose_name
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When djnago generates names from model members, capitalization may be a good thing (but should be configurable, todays modern web designs often use lowercase labels [yes you can do this in css, but why must I?]). But to capitalize verbose_names is an waste of computer power and makes django slower. Verbose name should be displayed as it was entered without any change when using in modelforms form.as_xxxx

Attachments (0)

Change History (5)

comment:1 Changed 2 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Despite the needlessly aggressive tone, this might be interesting, therefore not rejecting immediately (which was my first reflex when I read the title).

We probably can't do this for backwards-compatibility reasons anyway.

Last edited 2 years ago by aaugustin (previous) (diff)

comment:2 Changed 2 years ago by Evil Clay <clay.evil@…>

I'm sorry, i meant no harm with the title, just an attempt to describe relevant points in a short line. I like django very much, I programed in java for 5 years using Apache Wicket. But i can say that in many ways django is better. So thank you all, you have done a great job, and sorry for this "spam" comment, just wanted to set thing straight.

to add something to the matter at hand, i understand the backward issue i saw the changes in admin where all verbose_names were changed to lowercase. But i feel this is something that has to be done sooner or later.

Maybe you could add an default setting that will ensure current behavior but will also rise an deprecation warning on server start and you can override this setting you a project local settings file to turn off the Capitalization and this will also silence the deprecation warning.
As for the admin part, probably a lot of manual work to capitalize the verbose_names. I could help with that.

comment:3 Changed 2 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

We rely on verbose_name *not* having initial caps in your models, and we add caps wherever appropriate. It wouldn't work the other way around (expecting models to have initial caps, and lower-casing them when appropriate) because a verbose_name might be an all-caps acronym that shouldn't *ever* be lower-cased. And displaying verbose_names without an upper case just looks ugly. We have standards. :-)

comment:4 follow-up: Changed 16 months ago by mail@…

I agree with the contributor: when verbose_name is explicitely set it should at least be possible to disable automatic capitalisation. I have an verbose_name label that reads something like this "xABC". The lowercased x in the Acronym is semantically relevant. Auto-capitalization destroys that. Hopefully there's an easy, and consistent way to override that behavior.

comment:5 in reply to: ↑ 4 Changed 15 months ago by lukeplant

Replying to mail@…:

I have an verbose_name label that reads something like this "xABC"...

Try this:

class NoUpper(unicode):
    def upper(self):
        return self
    def __getitem__(self, key):
        return self.__class__(super(NoUpper, self).__getitem__(key))

...

verbose_name = NoUpper(u"xABC")

My brief experiments suggest this should work:

>>> capfirst(NoUpper(u"xABC"))
u'xABC'

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.