From 6abd6c598ea23e0a962c87b0075aa2f79f9ead36 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 1 Dec 2016 18:28:29 -0800 Subject: Fixed #27563 -- Moved "apply limit_choices_to" code from BaseModelForm to fields_for_model(). --- tests/model_forms/tests.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/model_forms') diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index d1c5b00d8a..f4216ca51b 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -2854,6 +2854,10 @@ class LimitChoicesToTest(TestCase): f = StumpJokeWithCustomFieldForm() self.assertEqual(f.fields['custom'].queryset, 42) + def test_fields_for_model_applies_limit_choices_to(self): + fields = fields_for_model(StumpJoke, ['has_fooled_today']) + self.assertSequenceEqual(fields['has_fooled_today'].queryset, [self.threepwood]) + class FormFieldCallbackTests(SimpleTestCase): -- cgit v1.3