mirror of
https://github.com/django/django.git
synced 2025-08-22 11:34:33 +00:00
Fixed #33902 -- Fixed Meta.constraints validation crash with F() expressions.
Thanks Adam Zahradník for the report.
Bug in 667105877e
.
This commit is contained in:
parent
c614e811f8
commit
63884829ac
4 changed files with 27 additions and 6 deletions
|
@ -393,9 +393,7 @@ class BaseExpression:
|
|||
clone = self.copy()
|
||||
clone.set_source_expressions(
|
||||
[
|
||||
references_map.get(expr.name, expr)
|
||||
if isinstance(expr, F)
|
||||
else expr.replace_references(references_map)
|
||||
expr.replace_references(references_map)
|
||||
for expr in self.get_source_expressions()
|
||||
]
|
||||
)
|
||||
|
@ -810,6 +808,9 @@ class F(Combinable):
|
|||
):
|
||||
return query.resolve_ref(self.name, allow_joins, reuse, summarize)
|
||||
|
||||
def replace_references(self, references_map):
|
||||
return references_map.get(self.name, self)
|
||||
|
||||
def asc(self, **kwargs):
|
||||
return OrderBy(self, **kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue