#27866 closed Cleanup/optimization (fixed)
Make ChoiceWidget.format_value() return a list
Reported by: | Claude Paroz | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently, ChoiceWidget.format_value
returns a set. I have a use case with a custom widget where selected value ordering matters. I can subclass format_value
in my widget subclass, but I wonder if the transformation to a set, losing value ordering, is there on purpose. It seems the test suite does not fail when keeping a list. I'll suggest a patch.
Change History (9)
comment:1 by , 8 years ago
Has patch: | set |
---|
comment:2 by , 8 years ago
Summary: | Make ChoiceWidget.format_value return a list → Make ChoiceWidget.format_value() return a list |
---|---|
Triage Stage: | Unreviewed → Accepted |
Version: | master → 1.11 |
That method is new in 1.11 for template-based widget rendering (b52c73008a9d67e9ddbb841872dc15cdd3d6ee01) so I think the change should be backported, probably without the force_text(v)
removal. How about tests for the method?
comment:3 by , 8 years ago
The method is new, but the behavior with the set()
is not new. We could backport, but that's not mandatory.
comment:4 by , 8 years ago
Needs tests: | set |
---|
comment:5 by , 8 years ago
Needs tests: | unset |
---|
comment:6 by , 8 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
https://github.com/django/django/pull/8090