summaryrefslogtreecommitdiff
path: root/tests/model_forms
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2016-12-01 18:28:29 -0800
committerJon Dufresne <jon.dufresne@gmail.com>2016-12-02 08:40:24 -0800
commit6abd6c598ea23e0a962c87b0075aa2f79f9ead36 (patch)
treeba0ef77b7887f14cb9a93f7bb1b86685fa6271da /tests/model_forms
parent6d1394182d8c4c02598e0cf47f42a5e86706411f (diff)
Fixed #27563 -- Moved "apply limit_choices_to" code from BaseModelForm to fields_for_model().
Diffstat (limited to 'tests/model_forms')
-rw-r--r--tests/model_forms/tests.py4
1 files changed, 4 insertions, 0 deletions
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):