From 7d7e5cd0554aab03d3e2732a67a2680d48fa48f7 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Fri, 5 Sep 2025 14:15:50 -0400 Subject: Refs #35444 -- Removed contrib.postgres aggregates ordering kwarg per deprecation timeline. --- django/contrib/postgres/aggregates/general.py | 14 +++----------- django/contrib/postgres/aggregates/mixins.py | 22 ++-------------------- 2 files changed, 5 insertions(+), 31 deletions(-) (limited to 'django') diff --git a/django/contrib/postgres/aggregates/general.py b/django/contrib/postgres/aggregates/general.py index b2ecd18ffb..ad3ff684cb 100644 --- a/django/contrib/postgres/aggregates/general.py +++ b/django/contrib/postgres/aggregates/general.py @@ -6,8 +6,6 @@ from django.db.models import StringAgg as _StringAgg from django.db.models import Value from django.utils.deprecation import RemovedInDjango70Warning -from .mixins import _DeprecatedOrdering - __all__ = [ "ArrayAgg", "BitAnd", @@ -20,9 +18,7 @@ __all__ = [ ] -# RemovedInDjango61Warning: When the deprecation ends, replace with: -# class ArrayAgg(Aggregate): -class ArrayAgg(_DeprecatedOrdering, Aggregate): +class ArrayAgg(Aggregate): function = "ARRAY_AGG" allow_distinct = True allow_order_by = True @@ -54,19 +50,15 @@ class BoolOr(Aggregate): output_field = BooleanField() -# RemovedInDjango61Warning: When the deprecation ends, replace with: -# class JSONBAgg(Aggregate): -class JSONBAgg(_DeprecatedOrdering, Aggregate): +class JSONBAgg(Aggregate): function = "JSONB_AGG" allow_distinct = True allow_order_by = True output_field = JSONField() -# RemovedInDjango61Warning: When the deprecation ends, replace with: -# class StringAgg(_StringAgg): # RemovedInDjango70Warning: When the deprecation ends, remove completely. -class StringAgg(_DeprecatedOrdering, _StringAgg): +class StringAgg(_StringAgg): def __init__(self, expression, delimiter, **extra): if isinstance(delimiter, str): diff --git a/django/contrib/postgres/aggregates/mixins.py b/django/contrib/postgres/aggregates/mixins.py index a6849c3930..5cfe47d96c 100644 --- a/django/contrib/postgres/aggregates/mixins.py +++ b/django/contrib/postgres/aggregates/mixins.py @@ -1,29 +1,11 @@ # RemovedInDjango70Warning: When the deprecation ends, remove completely. import warnings -from django.utils.deprecation import RemovedInDjango61Warning, RemovedInDjango70Warning - - -# RemovedInDjango61Warning. -class _DeprecatedOrdering: - def __init__(self, *expressions, ordering=(), order_by=(), **extra): - if ordering: - warnings.warn( - "The ordering argument is deprecated. Use order_by instead.", - category=RemovedInDjango61Warning, - stacklevel=2, - ) - if order_by: - raise TypeError("Cannot specify both order_by and ordering.") - order_by = ordering - - super().__init__(*expressions, order_by=order_by, **extra) +from django.utils.deprecation import RemovedInDjango70Warning # RemovedInDjango70Warning. -# RemovedInDjango61Warning: When the deprecation ends, replace with: -# class OrderableAggMixin: -class OrderableAggMixin(_DeprecatedOrdering): +class OrderableAggMixin: allow_order_by = True def __init_subclass__(cls, /, *args, **kwargs): -- cgit v1.3