I suppose I should post the full version, since my simplified attempt
didnt work :)
class ICount(Aggregate):
name = 'ICOUNT'
sql_function = 'COUNT'
sql_template = '%(function)s(LOWER(%(field)s))'
is_ordinal = True
def __init__(self, lookup, **extra):
self.lookup = lookup
self.extra = extra
def _default_alias(self):
return '%s__%s' % (self.lookup,
self.__class__.__name__.lower())
default_alias = property(_default_alias)
def add_to_query(self, query, alias, col, source, is_summary):
super(ICount, self).__init__(col, source, is_summary,
**self.extra)
query.aggregate_select[alias] = self
On Mar 22, 4:53 pm, David Cramer <[email protected]> wrote:
> One of the recent changes in trunk was a change to how querysets were
> cloned. Due to this, some old code we had is no longer working. This
> was a custom aggregate which relied on "aggregate_select" (see below).
> I believe the change I'm referring to is what is causing this, and I'm
> unsure of what the proper approach should be now. Should this also be
> considered a bug? If so, I'll go ahead and file a ticket.
>
> class ICount(Aggregate):
> sql_function = 'COUNT'
> sql_template = '%(function)s(LOWER(%(field)s))'
> is_ordinal = True
> name = 'ICOUNT'
>
> def add_to_query(self, query, alias, col, source, is_summary):
> super(ICount, self).__init__(col, source, is_summary,
> **self.extra)
> query.aggregate_select[alias] = self
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.