summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Muthig <camuthig@gmail.com>2024-08-14 13:54:09 -0600
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-03-03 11:37:00 +0100
commit1759c1dbd1e3cd4c9fcd345269e0d25796468f7f (patch)
tree417840a6627d5030d02303936a6ff2f2d4a584db
parent4b977a5d7283e7ca51288cc0ed0860e0004653ca (diff)
Refs #35444 -- Deprecated contrib.postgres.OrderableAggMixin.
This commit does not create any functional changes, but marks the existing `OrderableAggMixin` class as deprecated so that developers using it directly can be made aware of its future removal.
-rw-r--r--django/contrib/postgres/aggregates/mixins.py10
-rw-r--r--docs/internals/deprecation.txt3
-rw-r--r--docs/releases/6.0.txt3
3 files changed, 15 insertions, 1 deletions
diff --git a/django/contrib/postgres/aggregates/mixins.py b/django/contrib/postgres/aggregates/mixins.py
index bc416350ad..a6849c3930 100644
--- a/django/contrib/postgres/aggregates/mixins.py
+++ b/django/contrib/postgres/aggregates/mixins.py
@@ -1,6 +1,7 @@
+# RemovedInDjango70Warning: When the deprecation ends, remove completely.
import warnings
-from django.utils.deprecation import RemovedInDjango61Warning
+from django.utils.deprecation import RemovedInDjango61Warning, RemovedInDjango70Warning
# RemovedInDjango61Warning.
@@ -19,10 +20,17 @@ class _DeprecatedOrdering:
super().__init__(*expressions, order_by=order_by, **extra)
+# RemovedInDjango70Warning.
# RemovedInDjango61Warning: When the deprecation ends, replace with:
# class OrderableAggMixin:
class OrderableAggMixin(_DeprecatedOrdering):
allow_order_by = True
def __init_subclass__(cls, /, *args, **kwargs):
+ warnings.warn(
+ "OrderableAggMixin is deprecated. Use Aggregate and allow_order_by "
+ "instead.",
+ category=RemovedInDjango70Warning,
+ stacklevel=1,
+ )
super().__init_subclass__(*args, **kwargs)
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index a7695972eb..15a44e78e4 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -20,6 +20,9 @@ details on these changes.
* The ``django.contrib.postgres.aggregates.StringAgg`` class will be removed.
+* The ``django.contrib.postgres.aggregates.mixins.OrderableAggMixin`` class
+ will be removed.
+
.. _deprecation-removed-in-6.1:
6.1
diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt
index edf4ce0299..44b9781d44 100644
--- a/docs/releases/6.0.txt
+++ b/docs/releases/6.0.txt
@@ -301,6 +301,9 @@ Miscellaneous
* The PostgreSQL ``StringAgg`` class is deprecated in favor of the generally
available :class:`~django.db.models.StringAgg` class.
+* The PostgreSQL ``OrderableAggMixin`` is deprecated in favor of the
+ ``order_by`` attribute now available on the ``Aggregate`` class.
+
Features removed in 6.0
=======================