Opened 4 years ago
Closed 4 years ago
#32146 closed Cleanup/optimization (wontfix)
Make AutocompleteSelect and AutocompleteSelectMultiple easier to reuse
Reported by: | Andy Babic | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 3.1 |
Severity: | Normal | Keywords: | autocomplete |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The 'rel' argument currently required for Autocomplete widget instantiation is a little confusing if you don't know a huge amount about relationship field internals, and is also unnecessary, it would seem. It looks as though the only reason for passing this, is that the model class can be extracted from it. However, if used with ModelChoiceField
and ModelMultipleChoiceField
(which is, currently, always the case), that is available from the self.choices
(a ModelChoiceIterator
).
Note:
See TracTickets
for help on using tickets.
Thanks for this proposition. However, we have several tickets about bugs in
AutocompleteSelect
(see #29010 and #29138) and proposed solution is changingdb_field.rel
todb_field
that is used more widely. I don't think we can remove it.