1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #16055 -- Fixed crash when filtering against char/text GenericRelation relation on PostgreSQL.

This commit is contained in:
David Wobrock
2023-04-18 10:19:06 +02:00
committed by Mariusz Felisiak
parent 594fcc2b74
commit 9bbf97bcdb
11 changed files with 117 additions and 13 deletions

View File

@@ -72,6 +72,20 @@ class GenericRelationTests(TestCase):
TextLink.objects.create(content_object=oddrel)
oddrel.delete()
def test_charlink_filter(self):
oddrel = OddRelation1.objects.create(name="clink")
CharLink.objects.create(content_object=oddrel, value="value")
self.assertSequenceEqual(
OddRelation1.objects.filter(clinks__value="value"), [oddrel]
)
def test_textlink_filter(self):
oddrel = OddRelation2.objects.create(name="clink")
TextLink.objects.create(content_object=oddrel, value="value")
self.assertSequenceEqual(
OddRelation2.objects.filter(tlinks__value="value"), [oddrel]
)
def test_coerce_object_id_remote_field_cache_persistence(self):
restaurant = Restaurant.objects.create()
CharLink.objects.create(content_object=restaurant)