summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
Diffstat (limited to 'django/core')
-rw-r--r--django/core/paginator.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/django/core/paginator.py b/django/core/paginator.py
index 422da30aa1..2bf858cd54 100644
--- a/django/core/paginator.py
+++ b/django/core/paginator.py
@@ -6,6 +6,7 @@ from math import ceil
from asgiref.sync import sync_to_async
+from django.utils.deprecation import RemovedInDjango70Warning
from django.utils.functional import cached_property
from django.utils.inspect import method_has_no_args
from django.utils.translation import gettext_lazy as _
@@ -55,6 +56,18 @@ class BasePaginator:
if error_messages is None
else self.default_error_messages | error_messages
)
+ if self.per_page <= self.orphans:
+ # RemovedInDjango70Warning: When the deprecation ends, replace with:
+ # raise ValueError(
+ # "The orphans argument cannot be larger than or equal to the "
+ # "per_page argument."
+ # )
+ msg = (
+ "Support for the orphans argument being larger than or equal to the "
+ "per_page argument is deprecated. This will raise a ValueError in "
+ "Django 7.0."
+ )
+ warnings.warn(msg, category=RemovedInDjango70Warning, stacklevel=2)
def _check_object_list_is_ordered(self):
"""