#27161: TypedChoiceField fails to validate properly when used with ArrayField -------------------------------------+------------------------------------- Reporter: Roman Karpovich | Owner: Rômulo | Rosa Furtado Type: Bug | Status: assigned Component: Forms | Version: master Severity: Normal | Resolution: Keywords: TypedChoiceField | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Jeroen Dekkers):
* cc: jeroen@… (added) * needs_better_patch: 1 => 0 * needs_tests: 1 => 0 Comment: The problem with moving `_coerce` into `to_python` is that you can coerce to a value not present in `choices` and `clean` calls `to_python` before checking whether the value is in `choices`. I think the best way to fix this is having SimpleArrayField's `to_python` call `clean` on each array item to get the coerced value instead of calling `to_python`. Pull request with that fix and test case: https://github.com/django/django/pull/8358 -- Ticket URL: <https://code.djangoproject.com/ticket/27161#comment:6> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/063.d640af9871881d16c0b583bf52a489b4%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.