has_changed fails to compare model instance with primary key
|Reported by:||adsva||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have a ModelForm with a ModelChoiceField that has a model instance as initial data. The form is rendered as an extra form in a formset and
empty_permitted is True, but it still goes through validation since
has_changed on the widget fails to equate the pk of the pre-selected field as POSTed with the model instance from the initial data. Maybe ModelChoiceField needs its own widget that handles this comparison?