mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #27563 -- Moved "apply limit_choices_to" code from BaseModelForm to fields_for_model().
This commit is contained in:
parent
6d1394182d
commit
6abd6c598e
2 changed files with 9 additions and 7 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue