diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2025-09-05 14:15:50 -0400 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2025-09-17 15:17:05 -0300 |
| commit | 7d7e5cd0554aab03d3e2732a67a2680d48fa48f7 (patch) | |
| tree | 248c8f0768d73a6aec601cb5a056568575e10666 /django | |
| parent | 32e266dc5b756b52e6db4f4f453f51274aa9234e (diff) | |
Refs #35444 -- Removed contrib.postgres aggregates ordering kwarg per deprecation timeline.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/postgres/aggregates/general.py | 14 | ||||
| -rw-r--r-- | django/contrib/postgres/aggregates/mixins.py | 22 |
2 files changed, 5 insertions, 31 deletions
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): |
