New validations pulls all elements for foreignkeys
|Reported by:||Jani Tiainen||Owned by:||nobody|
|Severity:||Keywords:||validation foreignkey admin modelform|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Model validation added
validate() method on
forms.fields.Field . This method is called in a validation call chain from
ModelChoiceField . validate() method is only in
ModelChoiceField which inherits
validate() method pulls in all data from foreign key model by using expensive for loop.
Model forms and admin forms both suffer from this feature. Specially admin forms with raw_id_field when referring to model that contains millions of rows.