Opened 15 years ago
Closed 15 years ago
#12580 closed (duplicate)
New validations pulls all elements for foreignkeys
Reported by: | Jani Tiainen | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | Keywords: | validation foreignkey admin modelform | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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 ChoiceField
. 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.
Note:
See TracTickets
for help on using tickets.
Duplicate of #12510