1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #27148 -- Fixed ModelMultipleChoiceField crash with invalid UUID.

This commit is contained in:
Tim Graham
2016-10-31 15:21:05 -04:00
committed by GitHub
parent de91c172cf
commit 2f9861d823
3 changed files with 13 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import unicode_literals
from django import forms
from django.core.exceptions import ValidationError
from django.test import TestCase
from .models import UUIDPK
@@ -27,3 +28,8 @@ class ModelFormBaseTest(TestCase):
msg = "The UUIDPK could not be changed because the data didn't validate."
with self.assertRaisesMessage(ValueError, msg):
form.save()
def test_model_multiple_choice_field_uuid_pk(self):
f = forms.ModelMultipleChoiceField(UUIDPK.objects.all())
with self.assertRaisesMessage(ValidationError, "'invalid_uuid' is not a valid UUID."):
f.clean(['invalid_uuid'])