﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26321	"Missing ""for_save"" in examples of custom expression"	Tomasz Nowak	nobody	"Example at [https://docs.djangoproject.com/en/dev/ref/models/expressions/#writing-your-own-query-expressions] doesn't work:
{{{
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""xxx/django/db/models/query.py"", line 909, in annotate
    clone.query.add_annotation(annotation, alias, is_summary=False)
  File ""xxx/django/db/models/sql/query.py"", line 974, in add_annotation
    summarize=is_summary)
  File ""xxx/django/db/models/aggregates.py"", line 19, in resolve_expression
    c = super(Aggregate, self).resolve_expression(query, allow_joins, reuse, summarize)
  File ""xxx/django/db/models/expressions.py"", line 534, in resolve_expression
    c.source_expressions[pos] = arg.resolve_expression(query, allow_joins, reuse, summarize, for_save)
TypeError: resolve_expression() takes at most 5 arguments (6 given)
}}}
Adding ""for_save"" parameter to the method signature and calls fixes this issue.
Please find the patch attached."	Bug	closed	Documentation	1.9	Normal	fixed	expressions		Ready for checkin	1	0	0	0	1	0
