diff --git a/tests/forms_tests/tests/__init__.py b/tests/forms_tests/tests/__init__.py index 3fb537ef41..aea9418c05 100644 --- a/tests/forms_tests/tests/__init__.py +++ b/tests/forms_tests/tests/__init__.py @@ -12,7 +12,7 @@ from .test_input_formats import (LocalizedTimeTests, CustomTimeInputFormatsTests SimpleDateFormatTests, LocalizedDateTimeTests, CustomDateTimeInputFormatsTests, SimpleDateTimeFormatTests) from .test_media import FormsMediaTestCase, StaticFormsMediaTestCase -from .tests import (TestTicket12510, ModelFormCallableModelDefault, +from .tests import (TestTicket12510, TestTicket14567, ModelFormCallableModelDefault, FormsModelTestCase, RelatedModelFormTests) from .test_regressions import FormsRegressionsTestCase from .test_util import FormsUtilTestCase diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py index be75643b28..80e2cadcc3 100644 --- a/tests/forms_tests/tests/tests.py +++ b/tests/forms_tests/tests/tests.py @@ -46,7 +46,8 @@ class TestTicket14567(TestCase): """ def test_empty_queryset_return(self): "If a model's ManyToManyField has blank=True and is saved with no data, a queryset is returned." - form = OptionalMultiChoiceModelForm({'multi_choice_optional': '', 'multi_choice': ['1']}) + option = ChoiceOptionModel.objects.create(name='default') + form = OptionalMultiChoiceModelForm({'multi_choice_optional': '', 'multi_choice': [option.pk]}) self.assertTrue(form.is_valid()) # Check that the empty value is a QuerySet self.assertTrue(isinstance(form.cleaned_data['multi_choice_optional'], models.query.QuerySet))