summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
authorDan Moore <dan@moore.cx>2018-11-03 22:45:36 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-23 10:50:31 +0200
commitbc94e3c1a263da4b3eae3111c12270744907901b (patch)
tree288d97879beb827df39d29e5fdc80d8aa5e089d9 /tests/model_fields
parentf3855a8d2d9eee7f82e412a69bf42ad2df867462 (diff)
Fixed #29919 -- Fixed RelatedOnlyFieldListFilter crash with reverse relationships.
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
index 206ac8c84c..0d6e930b06 100644
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -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],
+ )