Opened 19 years ago
Closed 19 years ago
#3534 closed (fixed)
newforms ModelChoiceField should not cache choices
| Reported by: | Adrian Holovaty | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Forms | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
ModelChoiceField and ModelMultipleChoiceField cache the output of their queryset the first time self.choices is accessed. This is bad for long-running processes, such as mod_python, because the cache gets stale. Plus, it's bad saving all of those choices in memory. The attached unit tests illustrate the problem.
Attachments (1)
Change History (3)
comment:1 by , 19 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
by , 19 years ago
| Attachment: | model_choice_field_cache_tests.patch added |
|---|
comment:2 by , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Unit tests