"""
-__version__ = (2, 2, 4, "final", 0)
+__version__ = (2, 2, 5, "final", 0)
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-try:
- from django.utils.deprecation import MiddlewareMixin
-except ImportError:
- # Django < 1.10
- MiddlewareMixin = object
+from django.utils.deprecation import MiddlewareMixin
def get_page(self, suffix=''):
integer representing the current page.
"""
try:
- # REQUEST is deprecated as of Django 1.7.
key = 'page%s' % suffix
value = self.POST.get(key)
if value is None:
{% if display_page_links %}
{% for page in pages %}
{% if page %}
- {% ifequal page page_obj.number %}
+ {% if page == page_obj.number %}
<span class="current page">{{ page }}</span>
{% else %}
{% if disable_link_for_first_page and page == 1 %}
{% else %}
<a href="?page{{ page_suffix }}={{ page }}{{ getvars }}" class="page">{{ page }}</a>
{% endif %}
- {% endifequal %}
+ {% endif %}
{% else %}
...
{% endif %}
loader,
)
-try:
- from django.template.base import TokenType
- TOKEN_BLOCK = TokenType.BLOCK
-except ImportError:
- try:
- # Django 1.8-1.11
- from django.template.base import TOKEN_BLOCK
- except ImportError: # Django < 1.8
- from django.template import TOKEN_BLOCK
+from django.template.base import TokenType
+TOKEN_BLOCK = TokenType.BLOCK
from django.template.loader import select_template
from django.utils.text import unescape_string_literal
def runtests():
os.environ['DJANGO_SETTINGS_MODULE'] = 'fnp_django_pagination.tests.settings'
-
- try:
- django.setup()
- except AttributeError: # for Django 1.6 compatible
- pass
+ django.setup()
failures = call_command('test', 'fnp_django_pagination')
sys.exit(bool(failures))
from django.core.paginator import Paginator
from django.http import HttpRequest as DjangoHttpRequest
from django.template import Template, Context
-
-try:
- from django.test import SimpleTestCase
-except ImportError: # Django 1.2 compatible
- from django.test import TestCase as SimpleTestCase
-
+from django.test import SimpleTestCase
from fnp_django_pagination.paginator import InfinitePaginator, FinitePaginator
from fnp_django_pagination.templatetags.pagination_tags import paginate
from fnp_django_pagination.middleware import PaginationMiddleware
Test middleware
"""
def test_get_page_in_request(self):
- middleware = PaginationMiddleware()
+ middleware = PaginationMiddleware(lambda: None)
request = DjangoHttpRequest()
middleware.process_request(request)
self.assertEqual(request.page(''), 1)
[tox]
envlist=clear,
- d{12,13,14,15,16,17,18}-py27,
- d{19,110}-py{27,35},
- d111-py{27,35,36,37},
- d{20,21}-py{35,36,37},
- d22-py{35,36,37,38,39},
- d{30,31,32}-py{36,37,38,39}
+ d{21}-py{36,37},
+ d{22,30,31,32}-py{36,37,38,39}
+ d32-py{36,37,38,39,310}
+ d40-py{38,39,310}
stats
[testenv]
-indexserver=https://py.mdrn.pl:8443
commands=coverage run --source=fnp_django_pagination --omit *runner*,*test_project* setup.py test
deps=
- d12: Django>=1.2,<1.3
- d13: Django>=1.3,<1.4
- d14: Django>=1.4,<1.5
- d15: Django>=1.5,<1.6
- d16: Django>=1.6,<1.7
- d17: Django>=1.7,<1.8
- d18: Django>=1.8,<1.9
- d19: Django>=1.9,<1.10
- d110: Django>=1.10,<1.11
- d111: Django>=1.11,<2.0
d20: Django>=2.0,<2.1
d21: Django>=2.1,<2.2
d22: Django>=2.2,<3.0
d30: Django>=3.0,<3.1
d31: Django>=3.1,<3.2
d32: Django>=3.2,<4.0
+ d40: Django>=4.0,<4.1
coverage
[testenv:clear]