Coverage for utilities/query_functions.py: 100%
8 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
1from django.contrib.postgres.aggregates import JSONBAgg
2from django.db.models import Func
4__all__ = (
5 'CollateAsChar',
6 'EmptyGroupByJSONBAgg',
7)
10class CollateAsChar(Func):
11 """
12 Disregard localization by collating a field as a plain character string. Helpful for ensuring predictable ordering.
13 """
14 function = 'C'
15 template = '(%(expressions)s) COLLATE "%(function)s"'
18class EmptyGroupByJSONBAgg(JSONBAgg):
19 """
20 JSONBAgg is a builtin aggregation function which means it includes the use of a GROUP BY clause.
21 When used as an annotation for collecting config context data objects, the GROUP BY is
22 incorrect. This subclass overrides the Django ORM aggregation control to remove the GROUP BY.
23 """
24 contains_aggregate = False