Opened 17 years ago
Closed 17 years ago
#5830 closed (duplicate)
ModelChoiceField does not allow you to change the queryset on the widget after __init__ is called
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Uncategorized | Version: | newforms-admin |
Severity: | Keywords: | modelchoicefield property | |
Cc: | michael@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
ModelChoiceField.__init__ assigns the default queryset to self.widget.choices; then if you change field.queryset later it is too late, as it does not set self.widget.choices again.
This is easily done by making self.queryset a property()
Attachments (1)
Change History (3)
by , 17 years ago
Attachment: | modelchoicefield_queryset_as_property.diff added |
---|
comment:1 by , 17 years ago
Cc: | added |
---|
Note:
See TracTickets
for help on using tickets.
queryset as property