diff options
author | Anssi Kääriäinen <anssi.kaariainen@thl.fi> | 2015-02-02 13:48:30 +0200 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2015-03-25 08:05:22 -0400 |
commit | b68212f539f206679580afbfd008e7d329c9cd31 (patch) | |
tree | ccd9dd3b734617afd95b8de48fc9acb3823cc14d /tests/generic_relations_regress | |
parent | 8654c6a7329c06133b6c4b32f05e606132a338e5 (diff) | |
download | django-b68212f539f206679580afbfd008e7d329c9cd31.tar.gz |
Refs #24267 -- Implemented lookups for related fields
Previously related fields didn't implement get_lookup, instead
related fields were treated specially. This commit removed some of
the special handling. In particular, related fields return Lookup
instances now, too.
Other notable changes in this commit is removal of support for
annotations in names_to_path().
Diffstat (limited to 'tests/generic_relations_regress')
-rw-r--r-- | tests/generic_relations_regress/tests.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py index 0d78223725..b6782fe13f 100644 --- a/tests/generic_relations_regress/tests.py +++ b/tests/generic_relations_regress/tests.py @@ -144,22 +144,26 @@ class GenericRelationTests(TestCase): tag.save() def test_ticket_20378(self): + # Create a couple of extra HasLinkThing so that the autopk value + # isn't the same for Link and HasLinkThing. hs1 = HasLinkThing.objects.create() hs2 = HasLinkThing.objects.create() - l1 = Link.objects.create(content_object=hs1) - l2 = Link.objects.create(content_object=hs2) + hs3 = HasLinkThing.objects.create() + hs4 = HasLinkThing.objects.create() + l1 = Link.objects.create(content_object=hs3) + l2 = Link.objects.create(content_object=hs4) self.assertQuerysetEqual( HasLinkThing.objects.filter(links=l1), - [hs1], lambda x: x) + [hs3], lambda x: x) self.assertQuerysetEqual( HasLinkThing.objects.filter(links=l2), - [hs2], lambda x: x) + [hs4], lambda x: x) self.assertQuerysetEqual( HasLinkThing.objects.exclude(links=l2), - [hs1], lambda x: x) + [hs1, hs2, hs3], lambda x: x, ordered=False) self.assertQuerysetEqual( HasLinkThing.objects.exclude(links=l1), - [hs2], lambda x: x) + [hs1, hs2, hs4], lambda x: x, ordered=False) def test_ticket_20564(self): b1 = B.objects.create() |