summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-09-22 00:17:04 +0200
committerGitHub <noreply@github.com>2022-09-22 00:17:04 +0200
commitce6230aa976e8d963226a3956b45a8919215dbd8 (patch)
treea0b8ddedc258b0b38523c44377b4b1c71dde265b /django
parentcfe3008123ed7c9e3f3a4d51d4a22f9d96634e33 (diff)
Fixed #34015 -- Allowed filtering by transforms on relation fields.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/sql/query.py10
1 files changed, 0 insertions, 10 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 5dca423de4..12cb390e98 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1278,10 +1278,6 @@ class Query(BaseExpression):
# supports both transform and lookup for the name.
lookup_class = lhs.get_lookup(lookup_name)
if not lookup_class:
- if lhs.field.is_relation:
- raise FieldError(
- "Related Field got invalid lookup: {}".format(lookup_name)
- )
# A lookup wasn't found. Try to interpret the name as a transform
# and do an Exact lookup against it.
lhs = self.try_transform(lhs, lookup_name)
@@ -1450,12 +1446,6 @@ class Query(BaseExpression):
can_reuse.update(join_list)
if join_info.final_field.is_relation:
- # No support for transforms for relational fields
- num_lookups = len(lookups)
- if num_lookups > 1:
- raise FieldError(
- "Related Field got invalid lookup: {}".format(lookups[0])
- )
if len(targets) == 1:
col = self._get_col(targets[0], join_info.final_field, alias)
else: