ModelChoiceField.clean call to_python and validate from ChoiceField
|Reported by:||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Comment in ModelChoiceField says: This class is a subclass of ChoiceField for purity, but it doesn't actually use any of ChoiceField's implementation.
But with model level validation method ModelChoiceField.clean calls Field.clean and it calls self.to_python and self.validate, in reality ChoiceField.to_python and ChoiceField.validate. And for ModelChoiceField these methods are useless and can be harmful - for example (my problem) with hidden ModelChoiceField choices were not created but they are now, it could be very ineffective.
Change History (8)
comment:1 Changed 7 years ago by
|Triage Stage:||Unreviewed → Accepted|