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().
This commit is contained in:
Anssi Kääriäinen 2015-02-02 13:48:30 +02:00 committed by Tim Graham
parent 8654c6a732
commit b68212f539
6 changed files with 219 additions and 94 deletions

View file

@ -3678,3 +3678,11 @@ class TestTicket24279(TestCase):
School.objects.create()
qs = School.objects.filter(Q(pk__in=()) | Q())
self.assertQuerysetEqual(qs, [])
class TestInvalidValuesRelation(TestCase):
def test_invalid_values(self):
with self.assertRaises(ValueError):
Annotation.objects.filter(tag='abc')
with self.assertRaises(ValueError):
Annotation.objects.filter(tag__in=[123, 'abc'])