Skip to content

Commit

Permalink
Fixed django#373 - Fix relabaleing
Browse files Browse the repository at this point in the history
  • Loading branch information
csirmazbendeguz committed Jul 16, 2024
1 parent e463fe0 commit 0052f19
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions django/db/models/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ def get_source_expressions(self):
def set_source_expressions(self, exprs):
assert all(isinstance(expr, Col) for expr in exprs)
self.targets = [col.target for col in exprs]
self.sources = [col.output_field for col in exprs]
self.sources = [col.field for col in exprs]

def as_sql(self, compiler, connection):
cols_sql = []
Expand All @@ -1327,15 +1327,18 @@ def as_sql(self, compiler, connection):

return ", ".join(cols_sql), cols_params

@staticmethod
def db_converter(value, *_):
return (tuple(value),)

def relabeled_clone(self, relabels):
return self.__class__(
relabels.get(self.alias, self.alias), self.targets, self.sources, self.field
)

def resolve_expression(self, *args, **kwargs):
return self

@staticmethod
def db_converter(value, *_):
return (tuple(value),)


class Ref(Expression):
"""
Expand Down

0 comments on commit 0052f19

Please sign in to comment.