diff --git a/.travis.yml b/.travis.yml index 3ede88b..ecb17e6 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,12 @@ language: python +python: + - "3.7" matrix: include: - - - env: TOXENV=django111-py27 - python: '2.7' - - env: TOXENV=django111-py36 - python: '3.6' - - env: TOXENV=django20-py36 - python: '3.6' - - env: TOXENV=django30-py36 - python: '3.6' - + - env: TOXENV=django-2.2 + - env: TOXENV=django-3.0 - env: TOXENV=coverage - python: '3.6' install: - pip install tox diff --git a/admin_honeypot/admin.py b/admin_honeypot/admin.py index a886acf..e0a1810 100644 --- a/admin_honeypot/admin.py +++ b/admin_honeypot/admin.py @@ -20,17 +20,14 @@ def get_actions(self, request): def get_session_key(self, instance): return mark_safe('%(key)s' % {'key': instance.session_key}) get_session_key.short_description = _('Session') - get_session_key.allow_tags = True def get_ip_address(self, instance): return mark_safe('%(ip)s' % {'ip': instance.ip_address}) get_ip_address.short_description = _('IP Address') - get_ip_address.allow_tags = True def get_path(self, instance): return mark_safe('%(path)s' % {'path': instance.path}) get_path.short_description = _('URL') - get_path.allow_tags = True def has_add_permission(self, request, obj=None): return False diff --git a/admin_honeypot/urls.py b/admin_honeypot/urls.py index e52ed44..b45f4bd 100644 --- a/admin_honeypot/urls.py +++ b/admin_honeypot/urls.py @@ -1,9 +1,9 @@ from admin_honeypot import views -from django.conf.urls import url +from django.urls import path, re_path app_name = 'admin_honeypot' urlpatterns = [ - url(r'^login/$', views.AdminHoneypot.as_view(), name='login'), - url(r'^.*$', views.AdminHoneypot.as_view(), name='index'), + path('login/', views.AdminHoneypot.as_view(), name='login'), + re_path(r'^.*$', views.AdminHoneypot.as_view(), name='index'), ] diff --git a/admin_honeypot/views.py b/admin_honeypot/views.py index 3ac0c63..7f3b49a 100755 --- a/admin_honeypot/views.py +++ b/admin_honeypot/views.py @@ -6,7 +6,7 @@ from django.contrib.auth.views import redirect_to_login from django.shortcuts import redirect from django.urls import reverse -from django.utils.translation import ugettext as _ +from django.utils.translation import gettext as _ from django.views import generic diff --git a/docs/manual/install.rst b/docs/manual/install.rst index 34318d2..00b6af0 100755 --- a/docs/manual/install.rst +++ b/docs/manual/install.rst @@ -5,8 +5,8 @@ Installation Requirements ============ -* Python 2.6+ or Python 3.3+ -* Django 1.3+ +* Python 3.5+ +* Django 2.2+ Install ======= diff --git a/docs/manual/testing.rst b/docs/manual/testing.rst index 70c2d70..cc59db2 100644 --- a/docs/manual/testing.rst +++ b/docs/manual/testing.rst @@ -45,8 +45,8 @@ that this only tests against the latest Django release. ... _______________ summary _______________ - py27: commands succeeded - py33: commands succeeded + django-2x: commands succeeded + django-3x: commands succeeded congratulations :) diff --git a/setup.py b/setup.py index f063273..f44d755 100644 --- a/setup.py +++ b/setup.py @@ -15,21 +15,18 @@ classifiers=[ 'Development Status :: 5 - Production/Stable', 'Framework :: Django', - 'Framework :: Django :: 1.11', - 'Framework :: Django :: 2.0', + 'Framework :: Django :: 2.2', + 'Framework :: Django :: 3.0', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', ], keywords='django admin honeypot trap', diff --git a/tests/test_suite.py b/tests/test_suite.py index 0076311..9b236f1 100755 --- a/tests/test_suite.py +++ b/tests/test_suite.py @@ -1,19 +1,17 @@ import re +from urllib.parse import quote_plus + import django import pytest -from admin_honeypot.models import LoginAttempt + from django.conf import settings from django.core import mail from django.test import TestCase from django.urls import reverse -try: - # Python 2.7 - from urllib import quote_plus -except ImportError: - # Python 3+ - from urllib.parse import quote_plus +from admin_honeypot.models import LoginAttempt + class AdminHoneypotTest(TestCase): maxDiff = None diff --git a/tox.ini b/tox.ini index 605defc..c03daab 100644 --- a/tox.ini +++ b/tox.ini @@ -5,9 +5,8 @@ [tox] envlist = - django111-py{27,36} - django20-py36 - django30-py36 + django-2.2 + django-3.0 [testenvbase] deps = @@ -16,15 +15,14 @@ deps = pytest-pythonpath [testenv] +basepython = python3.7 commands = py.test tests/ deps = - django111: Django>=1.11,<2 - django20: Django>=2,<2.1 - django30: Django>=3,<4 + django-2.2: Django>=2.2,<3.0 + django-3.0: Django>=3.0,<3.1 {[testenvbase]deps} [testenv:coverage] -basepython = python3.6 passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH commands = py.test tests/ --cov admin_honeypot --cov-config .coveragerc --cov-report term-missing --pep8 admin_honeypot