summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorcan <cansarigol@derinbilgi.com.tr>2019-06-24 18:48:10 +0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-06-25 10:20:33 +0200
commit325d5d64452118d89624d8b4c8679f0d2cb3d6d6 (patch)
tree19b979b1a43cbc244206d208768c7c453f9f4e7c /django
parent76b993a117b61c41584e95149a67d8a1e9f49dd1 (diff)
Fixed #30477 -- Made reverse lookup use Field.get_db_prep_value() from the target field.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/lookups.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py
index 92c1a0fcc3..186e217083 100644
--- a/django/db/models/lookups.py
+++ b/django/db/models/lookups.py
@@ -176,8 +176,9 @@ class FieldGetDbPrepValueMixin:
get_db_prep_lookup_value_is_iterable = False
def get_db_prep_lookup(self, value, connection):
- # For relational fields, use the output_field of the 'field' attribute.
- field = getattr(self.lhs.output_field, 'field', None)
+ # For relational fields, use the 'target_field' attribute of the
+ # output_field.
+ field = getattr(self.lhs.output_field, 'target_field', None)
get_db_prep_value = getattr(field, 'get_db_prep_value', None) or self.lhs.output_field.get_db_prep_value
return (
'%s',