#26321: Missing "for_save" in examples of custom PostgreSQL aggregates
-------------------------------+--------------------------------
     Reporter:  tomaszn        |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  Documentation  |    Version:  1.9
     Severity:  Normal         |   Keywords:  postgres aggregate
 Triage Stage:  Unreviewed     |  Has patch:  1
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------------------
 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/26321>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.6ef7efa82b114ddcb5f1ed137df1bb87%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to