-
Notifications
You must be signed in to change notification settings - Fork 258
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
Customize field label #768
Comments
Hello. Why do you want to change field labels? Give some examples, please. And what other options have you considered? |
The client would like the labels to have the full language rather than the language code. I ended up overriding the verbose_name in |
Yeah. Well, let's make it happen. If you would prepare PR, I'll review and merge it. But, maybe we should not touch Maybe we should add a setting, like
And use (This is only suggestion, if you think of better option, let's hear it) |
I took a look and I think that adding it to the TranslationOption makes the most sense. The default method would be
and then the change to the TranslationField
The other place this affects is in I think TranslationOptions makes the most sense and is also logical for updating the documentation. |
Currently Translation fields are set with a verbose name of the model name and appended with the translation language code in brackets.
It would be nice to be able to customize the verbose name. I wasn't able to find a nice way to do this. I ended up overriding
formfield_for_dbfield
checking for aninstanceof TranslationField
and modifying the verbose name.The library creates the verbose name using
build_localized_verbose_name
which is used inbuild_localized_intermediary_model
andTranslationField
.I think this would make sense to add to the TranslationOption. Looking at the current shape of the options there isn't an obvious way to add a custom verbose name.
With the custom verbose name option,
TranslationField
can use this when set and fallback tobuild_localized_verbose_name
.This should also work for
build_localized_intermediary_model
because the options are ready during lazy registration.If this is interesting I am happy to implement once the update to TranslationOption is confirmed
The text was updated successfully, but these errors were encountered: