Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#26497 closed New feature (duplicate)

No Capitalization of user-defined verbose_names of model fields

Reported by: Sven R. Kunze Owned by: nobody
Component: Forms Version: 1.8
Severity: Normal Keywords:
Cc: tzanke@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When designing a new model, we named all fields as intended and correct capitalization using the verbose_name property.

So, we actually want all ModelForms to respect the well-defined capitalization. We couldn't find anything related in the docs.

How can this be achieved?

Change History (12)

comment:1 Changed 4 years ago by Tim Graham

Resolution: invalid
Status: newclosed

Please see TicketClosingReasons/UseSupportChannels for usage questions.

comment:2 Changed 4 years ago by Sven R. Kunze

Type: UncategorizedNew feature

Would this be a valid ticket if I change its type to "new Feature"?

"Disable capitalization of verbose_name of model fields in forms" ?

comment:3 Changed 4 years ago by TZanke

Cc: tzanke@… added

comment:5 Changed 4 years ago by Sven R. Kunze

Not sure if I understand it all correctly.

We want capfirst(field.verbose_name) deactivated WHEN we specify the verbose_name in the model field.

However, we don't think that it should be deactivated WHEN the verbose_name is generated from the field.name.

Does this makes sense? Is that different from the proposal?

comment:6 Changed 4 years ago by Tim Graham

The proposal on the mailing list is to drop all automatic capitalization in field labels in favor of doing it with CSS, e.g.

label::first-letter {
   text-transform: capitalize;
}

comment:7 Changed 4 years ago by Sven R. Kunze

So, it's not entirely what we think is useful.

Not sure if it is a locale-dependent issue, but in German, we actually like to see capitalized first letters. So, for auto-generated verbose_names, it's okay.

But when a developer specifies the capitalization himself via the verbose_name attribute, it should not be changed anymore.

Will have a look at the Sergei's attached patch.

comment:8 Changed 4 years ago by Sven R. Kunze

I did a quick review of the patch and opened PyCharm with a fresh Django 1.9.5 installation.

Maybe I am wrong, but it seems to me that he missed some usages of capfirst with regards to field names. Not sure if that is intended.

AFAICS, the patch does not distinguish between auto-generated verbose_name and user-defined verbose_name. So, the patch does not help in this regard. However, given the patch is applied, we would need to add all capitalized forms as explicit verbose_names. Not sure if I would like that; especially when it works so conveniently for the German language but it would solve the problem at hand.

comment:9 Changed 4 years ago by Sven R. Kunze

Summary: No Capitalization of verbose_name of model fields when Rendered by BoundFieldNo Capitalization of user-defined verbose_names of model fields

comment:10 Changed 4 years ago by Sven R. Kunze

Do you think it would make sense to separate out these two concepts in Django?

1) leave user-defined verbose_name of model fields alone
2) let user specify a format string which defines how to auto-generate a verbose_name of a model field

EDIT: (thus, also leave the auto-generated verbose_name alone)

Last edited 4 years ago by Sven R. Kunze (previous) (diff)

comment:11 Changed 4 years ago by Tim Graham

Resolution: invalidduplicate

It'll be better to raise your proposal on the linked mailing list discussion.

In the absence of the other patch, I don't think it makes sense to remove auto-capitalization of user-defined verbose names as the existing convention is to define those as lower-cased strings and rely on Django to do capitalization as necessary. Of course, sometimes this isn't desired, but changing it will be backwards-incompatible.

Now that I understand your proposal, I see it's a duplicate of #18129.

comment:12 Changed 4 years ago by Sven R. Kunze

Interesting tone at the other ticket.

Anyway, I think I will try to join that mailing list. I hope I get the registration right.

I will post my thoughts there. Consider this ticket obsolete.

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