mirror of
https://github.com/django/django.git
synced 2025-08-23 18:29:12 +00:00
Refs #25517 -- Fixed backport inconsistencies.
This commit is contained in:
parent
42e029f6c4
commit
61ea371822
@ -339,6 +339,17 @@ class BaseExpression(object):
|
|||||||
def reverse_ordering(self):
|
def reverse_ordering(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def flatten(self):
|
||||||
|
"""
|
||||||
|
Recursively yield this expression and all subexpressions, in
|
||||||
|
depth-first order.
|
||||||
|
"""
|
||||||
|
yield self
|
||||||
|
for expr in self.get_source_expressions():
|
||||||
|
if expr:
|
||||||
|
for inner_expr in expr.flatten():
|
||||||
|
yield inner_expr
|
||||||
|
|
||||||
|
|
||||||
class Expression(BaseExpression, Combinable):
|
class Expression(BaseExpression, Combinable):
|
||||||
"""
|
"""
|
||||||
|
@ -47,8 +47,8 @@ class ConcatPair(Func):
|
|||||||
return super(ConcatPair, coalesced).as_sql(compiler, connection)
|
return super(ConcatPair, coalesced).as_sql(compiler, connection)
|
||||||
|
|
||||||
def as_mysql(self, compiler, connection):
|
def as_mysql(self, compiler, connection):
|
||||||
self.coalesce()
|
coalesced = self.coalesce()
|
||||||
return super(ConcatPair, self).as_sql(compiler, connection)
|
return super(ConcatPair, coalesced).as_sql(compiler, connection)
|
||||||
|
|
||||||
def coalesce(self):
|
def coalesce(self):
|
||||||
# null on either side results in null for expression, wrap with coalesce
|
# null on either side results in null for expression, wrap with coalesce
|
||||||
|
Loading…
x
Reference in New Issue
Block a user