Commit 8b891cf3 authored by Tim Graham's avatar Tim Graham
Browse files

[1.8.x] Fixed #26321 -- Added missing "for_save" parameter in expressions example.

Thanks tomaszn for the patch.

Backport of de8a11ba from master
parent e4be3c80
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -448,7 +448,7 @@ calling the appropriate methods on the wrapped expression.
        Tells Django that this expression contains an aggregate and that a
        ``GROUP BY`` clause needs to be added to the query.

    .. method:: resolve_expression(query=None, allow_joins=True, reuse=None, summarize=False)
    .. method:: resolve_expression(query=None, allow_joins=True, reuse=None, summarize=False, for_save=False)

        Provides the chance to do any pre-processing or validation of
        the expression before it's added to the query. ``resolve_expression()``
@@ -579,11 +579,11 @@ Now we implement the pre-processing and validation. Since we do not have
any of our own validation at this point, we just delegate to the nested
expressions::

    def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False):
    def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
        c = self.copy()
        c.is_summary = summarize
        for pos, expression in enumerate(self.expressions):
            c.expressions[pos] = expression.resolve_expression(query, allow_joins, reuse, summarize)
            c.expressions[pos] = expression.resolve_expression(query, allow_joins, reuse, summarize, for_save)
        return c

Next, we write the method responsible for generating the SQL::