diff options
| author | Tim Graham <timograham@gmail.com> | 2016-10-31 15:21:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-31 15:21:05 -0400 |
| commit | 2f9861d823620da7ecb291a8f005f53da12b1e89 (patch) | |
| tree | 31e882eaf3e99a486bea89fe25c0b246f9b94988 /tests/model_forms | |
| parent | de91c172cfda624451fab9a87be92cc0d32e1fcf (diff) | |
Fixed #27148 -- Fixed ModelMultipleChoiceField crash with invalid UUID.
Diffstat (limited to 'tests/model_forms')
| -rw-r--r-- | tests/model_forms/test_uuid.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/model_forms/test_uuid.py b/tests/model_forms/test_uuid.py index 4dc7d511d7..b30da6d465 100644 --- a/tests/model_forms/test_uuid.py +++ b/tests/model_forms/test_uuid.py @@ -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']) |
