mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #36197 -- Fixed improper many-to-many count() and exists() for non-pk to_field.
Regression in 66e47ac69a.
Thanks mfontana-elem for the report and Sarah for the tests.
This commit is contained in:
committed by
Sarah Boyce
parent
51398f8bd5
commit
c3a23aa02f
@@ -533,3 +533,11 @@ class M2mThroughToFieldsTests(TestCase):
|
||||
[choice[0] for choice in field.get_choices(include_blank=False)],
|
||||
["pea", "potato", "tomato"],
|
||||
)
|
||||
|
||||
def test_count(self):
|
||||
self.assertEqual(self.curry.ingredients.count(), 3)
|
||||
self.assertEqual(self.tomato.recipes.count(), 1)
|
||||
|
||||
def test_exists(self):
|
||||
self.assertTrue(self.curry.ingredients.exists())
|
||||
self.assertTrue(self.tomato.recipes.exists())
|
||||
|
||||
Reference in New Issue
Block a user