#33468: aggregate() with 'default' after annotate() crashes.
-------------------------------------+-------------------------------------
Reporter: Adam Johnson | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
This issue should be fixed by:
{{{#!diff
diff --git a/django/db/models/aggregates.py
b/django/db/models/aggregates.py
index 8c4eae7906..e4c81547c1 100644
--- a/django/db/models/aggregates.py
+++ b/django/db/models/aggregates.py
@@ -65,7 +65,9 @@ class Aggregate(Func):
if hasattr(default, 'resolve_expression'):
default = default.resolve_expression(query, allow_joins,
reuse, summarize)
c.default = None # Reset the default argument before wrapping.
- return Coalesce(c, default, output_field=c._output_field_or_none)
+ coalesce = Coalesce(c, default,
output_field=c._output_field_or_none)
+ coalesce.is_summary = True
+ return coalesce
@property
def default_alias(self):
}}}
I will prepare a proper patch in the evening.
--
Ticket URL: <https://code.djangoproject.com/ticket/33468#comment:6>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/068.87b4934a8c8e3468e6ac5bab4b34501d%40djangoproject.com.