From d549b8805053d4b064bf492ba90e90db5d7e2a6b Mon Sep 17 00:00:00 2001 From: Mads Jensen Date: Mon, 18 Sep 2017 15:42:29 +0200 Subject: Fixed #26608 -- Added support for window expressions (OVER clause). Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes, Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie Cockburn for initial patch. --- django/db/models/sql/where.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'django/db/models/sql/where.py') diff --git a/django/db/models/sql/where.py b/django/db/models/sql/where.py index ed24b08bd0..0ca95f7018 100644 --- a/django/db/models/sql/where.py +++ b/django/db/models/sql/where.py @@ -167,6 +167,16 @@ class WhereNode(tree.Node): def contains_aggregate(self): return self._contains_aggregate(self) + @classmethod + def _contains_over_clause(cls, obj): + if isinstance(obj, tree.Node): + return any(cls._contains_over_clause(c) for c in obj.children) + return obj.contains_over_clause + + @cached_property + def contains_over_clause(self): + return self._contains_over_clause(self) + @property def is_summary(self): return any(child.is_summary for child in self.children) -- cgit v1.3