#33731: Updating choices with list methods does not update widget's choices.
-------------------------------------+-------------------------------------
Reporter: Stefan-Ionut | Owner: Aman
Tarabuta | Pandey
Type: | Status: closed
Cleanup/optimization |
Component: Forms | Version: 3.2
Severity: Normal | Resolution: wontfix
Keywords: ChoiceField, | Triage Stage:
choices, form | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: assigned => closed
* type: Bug => Cleanup/optimization
* resolution: => wontfix
Comment:
Thanks for this report, however IMO it's not doable.
[https://docs.djangoproject.com/en/stable/ref/forms/fields/#django.forms.ChoiceField.choices
choices] supports many types and we cannot enforce updating widget's
`choices` when built-in methods are called for `list` or `tuple`, it's a
different layer. I'd recommend to use a callable for `choices` or to
enforce updating `widget.choices` :
{{{
self.fields["my_field"].widget.choices = self.fields["my_field"].choices
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33731#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070180ef428ceb-4b3d9b49-05ce-40fa-ba40-f81dd51a3e48-000000%40eu-central-1.amazonses.com.