diff options
| author | varunnaganathan <varunnaganathan912@gmail.com> | 2015-12-24 21:12:49 +0530 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-01-02 08:19:41 -0500 |
| commit | 5770c2382a4ebeebaaf3c2736e3934a191265a18 (patch) | |
| tree | e1df2715ca70155a7fbad2d66ecf77b7b57056da /django | |
| parent | 2f4be218e1e6605ecbb84365d761c206c241e221 (diff) | |
[1.9.x] Fixed #25316 -- Fixed a crash with order_by() and values() after annotate().
Backport of 3eba9638ee69138c73efb1d1c1d1b806ddafc6cf from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/expressions.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 93e72cfb18..f03a2736b3 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -748,7 +748,8 @@ class When(Expression): def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False): c = self.copy() c.is_summary = summarize - c.condition = c.condition.resolve_expression(query, allow_joins, reuse, summarize, False) + if hasattr(c.condition, 'resolve_expression'): + c.condition = c.condition.resolve_expression(query, allow_joins, reuse, summarize, False) c.result = c.result.resolve_expression(query, allow_joins, reuse, summarize, for_save) return c |
