mirror of
https://github.com/django/django.git
synced 2025-08-22 11:34:33 +00:00
Fixed #24343 -- Ensure db converters are used for foreign keys.
Joint effort between myself, Josh, Anssi and Shai.
This commit is contained in:
parent
dbacbc729a
commit
4755f8fc25
7 changed files with 44 additions and 15 deletions
|
@ -585,10 +585,10 @@ class Random(ExpressionNode):
|
|||
|
||||
|
||||
class Col(ExpressionNode):
|
||||
def __init__(self, alias, target, source=None):
|
||||
if source is None:
|
||||
source = target
|
||||
super(Col, self).__init__(output_field=source)
|
||||
def __init__(self, alias, target, output_field=None):
|
||||
if output_field is None:
|
||||
output_field = target
|
||||
super(Col, self).__init__(output_field=output_field)
|
||||
self.alias, self.target = alias, target
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -606,7 +606,10 @@ class Col(ExpressionNode):
|
|||
return [self]
|
||||
|
||||
def get_db_converters(self, connection):
|
||||
return self.output_field.get_db_converters(connection)
|
||||
if self.target == self.output_field:
|
||||
return self.output_field.get_db_converters(connection)
|
||||
return (self.output_field.get_db_converters(connection) +
|
||||
self.target.get_db_converters(connection))
|
||||
|
||||
|
||||
class Ref(ExpressionNode):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue