Opened 9 years ago
Last modified 9 years ago
#25114 closed Cleanup/optimization
ModelAdmin FK fields should default to raw_id — at Initial Version
Reported by: | damon c | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Foreign key fields in the admin currently default to a behavior that can cause crashing and user inconvenience.
The default behavior is to render a <select> element containing every instance of the model referred to by the FK.
When this field refers to a model that has for example, 100,000 or more entries, this can have the affect of crashing a server, a browser, or at best making new users confused about why they cannot view the admin page for this instance.
Defaulting to raw_id is safer and more reliable in most cases and presents minimal compromises in usability (in my opinion).