django.db.models.Sum does not work on BooleanField
|Reported by:||dp_wiz||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Models are Point -(fkey)-> Group and i'm trying to annotate Group queryset with a number of total points and a number of "active" points. Point.active is a BooleanField.
queryset = Group.objects.annotate( point_count = Count('point'), points_active = Sum('point__active'))
Exception Type: DatabaseError at /kiosks/wl/ Exception Value: function sum(boolean) does not exist LINE 1: ..."id", "kiwl_group"."title", "kiwl_group"."descr", SUM("kiwl_... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
However, there is a Bug Report which is marked "fixed" and it looks like there is something i could to to actually get a Sum on BoolanField-s.
Change History (5)
Changed 4 years ago by claudep
comment:1 Changed 4 years ago by claudep
- Keywords postgresql added
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
- Version changed from 1.3 to SVN