#3482: MultipleChoiceField validation against a list with a single null element -------------------------------------+------------------------------------- Reporter: Jeff Bauer | Owner: nobody <jbauer@…> | Type: Uncategorized | Status: new Component: Forms | Version: dev Severity: Normal | Resolution: Keywords: MultipleChoiceField | Triage Stage: Ready for | checkin Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Joshua Smith):
* status: closed => new * severity: => Normal * resolution: fixed => * easy: => 0 * ui_ux: => 0 * type: => Uncategorized Comment: This is still happening for me in Django 3.1.13: {{{ >>> from django.forms import MultipleChoiceField >>> f = MultipleChoiceField(required=False, choices=[('1', '1'), ('2', '2')]) >>> f.clean(['']) Traceback (most recent call last): File "/Users/joshsmith/.pyenv/versions/3.9.4/lib/python3.9/code.py", line 90, in runcode exec(code, self.locals) File "<console>", line 1, in <module> File "/Users/joshsmith/code/course-platform/.venv/lib/python3.9/site- packages/django/forms/fields.py", line 150, in clean self.validate(value) File "/Users/joshsmith/code/course-platform/.venv/lib/python3.9/site- packages/django/forms/fields.py", line 883, in validate raise ValidationError( django.core.exceptions.ValidationError: ['Select a valid choice. is not one of the available choices.'] }}} -- Ticket URL: <https://code.djangoproject.com/ticket/3482#comment:5> 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/087.9c4191107035936f2191fea33ba6f9f4%40djangoproject.com.