Using a custom widget for a item in ModelForm should use the model verbose_name?
|Reported by:||waltercruz||Owned by:||nobody|
|Severity:||Keywords:||forms, model, verbose name, label|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Hi all! To simplify my question, I will use a sample code from the docs: http://docs.djangoproject.com/en/dev/topics/forms/modelforms/?from=olddocs#a-full-example.
Say, by example, that I have added verbose names to the three fields, name as "Full Name", title as "Honor Title" and birth_date as "Birthday". Using a custom widget on a model form (like the sample, widget=forms.Select(choices=TITLE_CHOICES) to the title field) will make my form don't use the verbose name from the modelas the label. To add the correct label, I've to add a label='Something'. I expected that the generated model would use the verbose names from the model, even if I override some widget. Am I right in my expectation?
Change History (2)
comment:1 Changed 6 years ago by waltercruz
- Component changed from Uncategorized to Forms
- Keywords forms model verbose name label added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset