documentation error on ModelForm ModelChoiceField empty option
|Reported by:||carljm||Owned by:||carljm|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The ModelForms documentation at the bottom of the "field types" list states:
The blank choice will not be included if the model field has blank=False and an explicit default value (the default value will be initially selected instead).
It is true that the default value is initially selected if given, but it is not true that the "blank choice will not be included". It is included regardless, unless empty_label is explicitly set to None.
I would consider the documented behavior here to be better than the actual behavior, but given backwards-compatibility it's probably the docs that need to change.
Change History (7)
comment:1 Changed 7 years ago by mtredinnick
- milestone set to 1.1
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
Changed 7 years ago by carljm
comment:2 Changed 7 years ago by carljm
- Owner changed from nobody to carljm
- Status changed from new to assigned
comment:5 Changed 7 years ago by russellm
- Resolution set to fixed
- Status changed from assigned to closed