Python django.db.models.aggregates.Aggregate() Examples

The following are 3 code examples for showing how to use django.db.models.aggregates.Aggregate(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module django.db.models.aggregates , or try the search function .

Example 1
Project: openhgsenti   Author: drexly   File: statistics.py    License: Apache License 2.0 5 votes vote down vote up
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
        return super(Aggregate, self).resolve_expression(query, allow_joins, reuse, summarize) 
Example 2
Project: python2017   Author: bpgc-cte   File: statistics.py    License: MIT License 5 votes vote down vote up
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):
        return super(Aggregate, self).resolve_expression(query, allow_joins, reuse, summarize) 
Example 3
Project: djongo   Author: nesdis   File: tests.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def test_distinct_aggregation(self):
        class DistinctAggregate(Aggregate):
            allow_distinct = True
        aggregate = DistinctAggregate('first', 'second', distinct=True)
        msg = (
            "SQLite doesn't support DISTINCT on aggregate functions accepting "
            "multiple arguments."
        )
        with self.assertRaisesMessage(NotSupportedError, msg):
            connection.ops.check_expression_support(aggregate)