mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #30477 -- Made reverse lookup use Field.get_db_prep_value() from the target field.
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user