﻿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
17564	django.db.models.Sum does not work on BooleanField	wiz	nobody	"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.

Code:
{{{
#!python

queryset = Group.objects.annotate(
    point_count = Count('point'),
    points_active = Sum('point__active'))
}}}

Error:
{{{
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 [https://bugzilla.mozilla.org/show_bug.cgi?id=284125 Bug Report] which is marked ""fixed"" and it looks like there is something i could to to actually get a Sum on BoolanField-s."	Bug	closed	Database layer (models, ORM)	dev	Normal	fixed	postgresql	anssi.kaariainen@…	Accepted	0	0	0	0	0	0
