mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
d470848b29
* Clean up base modules * Clean up forms modules * Clean up templatetags modules * Replace custom simplify_decimal filter with floatformat * Misc cleanup * Merge ReturnURLForm into ConfirmationForm * Clean up import statements for utilities.forms * Fix field class references in docs
25 lines
773 B
Python
25 lines
773 B
Python
from django.contrib.postgres.aggregates import JSONBAgg
|
|
from django.db.models import Func
|
|
|
|
__all__ = (
|
|
'CollateAsChar',
|
|
'EmptyGroupByJSONBAgg',
|
|
)
|
|
|
|
|
|
class CollateAsChar(Func):
|
|
"""
|
|
Disregard localization by collating a field as a plain character string. Helpful for ensuring predictable ordering.
|
|
"""
|
|
function = 'C'
|
|
template = '(%(expressions)s) COLLATE "%(function)s"'
|
|
|
|
|
|
class EmptyGroupByJSONBAgg(JSONBAgg):
|
|
"""
|
|
JSONBAgg is a builtin aggregation function which means it includes the use of a GROUP BY clause.
|
|
When used as an annotation for collecting config context data objects, the GROUP BY is
|
|
incorrect. This subclass overrides the Django ORM aggregation control to remove the GROUP BY.
|
|
"""
|
|
contains_aggregate = False
|