Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tables overrides model's verbose_name with auto-capitalization #475

Closed
spaasis opened this issue Aug 30, 2017 · 5 comments
Closed

Tables overrides model's verbose_name with auto-capitalization #475

spaasis opened this issue Aug 30, 2017 · 5 comments

Comments

@spaasis
Copy link

spaasis commented Aug 30, 2017

Hi,

I have some columns in my table that use specified units, for example Amount (mg). I have this defined in the model's verbose_name, and it shows as intended in for example Django Admin. However, in the table it shows as Amount (Mg), with a capitalized M (going from millis to megas :) ). This is also a problem with different translations, since in for example Finnish we don't tend to capitalize each word in headings etc.

I know I could define verbose_name again in the table class, but that would mean double work, and make maintenance a bit more difficult.

Is this behaviour intended? Is there some workaround or configuration that I could use to disable this?

Thanks for an awesome plugin!

@jieter
Copy link
Owner

jieter commented Aug 30, 2017

I've be bitten by this too, but it's the way it was when I started maintaining this plugin. I'm open to changing this if there is a more sensible way, but it should be thought through, documented and tested well.

If you can, please propose a changes using a PR.

@jiajianbo
Copy link

jiajianbo commented Aug 31, 2017 via email

@jieter
Copy link
Owner

jieter commented Aug 31, 2017

verbose_name argument to model fields is not for the database either: it's used in ModelForms and the admin.

django docs on Verbose field names state:

The convention is not to capitalize the first letter of the verbose_name. Django will automatically capitalize the first letter where it needs to.

django-tables2 capitalizes every word of the verbose name. This is different from what django does, so changing it to the django default behavior makes sense to me.

@mbertheau
Copy link
Contributor

Just for reference, titlization was removed in #187, then added again in #249, #368, #382.

@jieter jieter mentioned this issue Mar 8, 2018
7 tasks
@jieter
Copy link
Owner

jieter commented Apr 10, 2018

landed in master, I just did a pre-release of 2.0.0 with version 2.0.0a0. Please help by testing and report any issues.

@jieter jieter closed this as completed Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants