Refs #29703 -- Removed QuerySetPaginator alias per deprecation timeline.
This commit is contained in:
parent
cb2be9d5d5
commit
81993b47ea
|
@ -3,7 +3,6 @@ import inspect
|
||||||
import warnings
|
import warnings
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
from django.utils.deprecation import RemovedInDjango31Warning
|
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.inspect import method_has_no_args
|
from django.utils.inspect import method_has_no_args
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
@ -126,16 +125,6 @@ class Paginator:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class QuerySetPaginator(Paginator):
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
warnings.warn(
|
|
||||||
'The QuerySetPaginator alias of Paginator is deprecated.',
|
|
||||||
RemovedInDjango31Warning, stacklevel=2,
|
|
||||||
)
|
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class Page(collections.abc.Sequence):
|
class Page(collections.abc.Sequence):
|
||||||
|
|
||||||
def __init__(self, object_list, number, paginator):
|
def __init__(self, object_list, number, paginator):
|
||||||
|
|
|
@ -232,6 +232,8 @@ to remove usage of these features.
|
||||||
|
|
||||||
* ``django.utils.timezone.FixedOffset`` is removed.
|
* ``django.utils.timezone.FixedOffset`` is removed.
|
||||||
|
|
||||||
|
* ``django.core.paginator.QuerySetPaginator`` is removed.
|
||||||
|
|
||||||
* ``django.contrib.postgres.fields.FloatRangeField`` and
|
* ``django.contrib.postgres.fields.FloatRangeField`` and
|
||||||
``django.contrib.postgres.forms.FloatRangeField`` are removed.
|
``django.contrib.postgres.forms.FloatRangeField`` are removed.
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,10 @@ import warnings
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.core.paginator import (
|
from django.core.paginator import (
|
||||||
EmptyPage, InvalidPage, PageNotAnInteger, Paginator, QuerySetPaginator,
|
EmptyPage, InvalidPage, PageNotAnInteger, Paginator,
|
||||||
UnorderedObjectListWarning,
|
UnorderedObjectListWarning,
|
||||||
)
|
)
|
||||||
from django.test import SimpleTestCase, TestCase
|
from django.test import SimpleTestCase, TestCase
|
||||||
from django.utils.deprecation import RemovedInDjango31Warning
|
|
||||||
|
|
||||||
from .custom import ValidAdjacentNumsPaginator
|
from .custom import ValidAdjacentNumsPaginator
|
||||||
from .models import Article
|
from .models import Article
|
||||||
|
@ -298,12 +297,6 @@ class PaginationTests(SimpleTestCase):
|
||||||
with self.assertRaises(EmptyPage):
|
with self.assertRaises(EmptyPage):
|
||||||
paginator.get_page(1)
|
paginator.get_page(1)
|
||||||
|
|
||||||
def test_querysetpaginator_deprecation(self):
|
|
||||||
msg = 'The QuerySetPaginator alias of Paginator is deprecated.'
|
|
||||||
with self.assertWarnsMessage(RemovedInDjango31Warning, msg) as cm:
|
|
||||||
QuerySetPaginator([], 1)
|
|
||||||
self.assertEqual(cm.filename, __file__)
|
|
||||||
|
|
||||||
|
|
||||||
class ModelPaginationTests(TestCase):
|
class ModelPaginationTests(TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue