#33093: Overriding default fields overrides Meta labels
------------------------------------------+------------------------
Reporter: Abhijeet Viswa | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 1 |
------------------------------------------+------------------------
Right of the bat, I'd like to say that I'm not sure if this is a proper
bug or not. It felt like a bug, and it took some time to figure out what
the issue was.
Here's a minimal example example:
{{{
class ExampleForm(forms.ModelForm):
name = forms.CharField()
class Meta:
model = ExampleModel
fields = ('name', )
labels = {
'name': 'Test Label',
}
}}}
`ExampleForm().fields['name'].label` is None because `label` is not passed
into the overriding field declaration. Ideally, the lack of a field
attribute should result in label declared in `Meta.labels` being used
instead of prettifying it using `capfirst`. Alternatively, this can be
added to the documentation.
--
Ticket URL: <https://code.djangoproject.com/ticket/33093>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.afb14f265bc3f46e39d93c6dd7996018%40djangoproject.com.