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:
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user