mirror of
https://github.com/django/django.git
synced 2025-07-13 16:25:13 +00:00
Fixed #29919 -- Fixed RelatedOnlyFieldListFilter crash with reverse relationships.
This commit is contained in:
parent
f3855a8d2d
commit
bc94e3c1a2
3 changed files with 54 additions and 2 deletions
|
@ -289,3 +289,14 @@ class GetChoicesLimitChoicesToTests(TestCase):
|
|||
self.field.get_choices(include_blank=False, limit_choices_to={}),
|
||||
[self.foo1, self.foo2],
|
||||
)
|
||||
|
||||
def test_get_choices_reverse_related_field(self):
|
||||
field = self.field.remote_field
|
||||
self.assertChoicesEqual(
|
||||
field.get_choices(include_blank=False, limit_choices_to={'b': 'b'}),
|
||||
[self.bar1],
|
||||
)
|
||||
self.assertChoicesEqual(
|
||||
field.get_choices(include_blank=False, limit_choices_to={}),
|
||||
[self.bar1, self.bar2],
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue