diff --git a/.travis.yml b/.travis.yml index 15e53fc..7f0d524 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,12 +28,6 @@ matrix: env: WAGTAIL="wagtail>=1.9,<1.10" - python: "3.5" env: WAGTAIL="wagtail>=1.8,<1.9" - - python: "3.5" - env: WAGTAIL="wagtail>=1.6,<1.7" - - python: "3.5" - env: WAGTAIL="wagtail>=1.5,<1.6" - - python: "3.5" - env: WAGTAIL="wagtail>=1.4,<1.5" before_script: - mysql -e 'create database wagtail_modeltranslation;' - psql -c 'create database wagtail_modeltranslation;' -U postgres diff --git a/runtests.py b/runtests.py index ccd96a2..ebd557f 100755 --- a/runtests.py +++ b/runtests.py @@ -5,10 +5,7 @@ import sys import django from django.conf import settings from django.core.management import call_command -try: - from wagtail import VERSION -except ImportError: - VERSION = 1, 6, 3 # assume it's 1.6.3, the latest version without VERSION +from wagtail import VERSION def runtests(): @@ -36,7 +33,7 @@ def runtests(): # Configure test environment import wagtail - if VERSION[0] < 2: + if VERSION < (2,): WAGTAIL_MODULES = [ 'wagtail.wagtailcore', 'wagtail.wagtailadmin', @@ -71,7 +68,7 @@ def runtests(): ] WAGTAIL_CORE = 'wagtail.core' - + settings.configure( DATABASES=DATABASES, INSTALLED_APPS=[ @@ -93,8 +90,7 @@ def runtests(): MIDDLEWARE_CLASSES=(), ) - if django.VERSION >= (1, 7): - django.setup() + django.setup() failures = call_command( 'test', 'wagtail_modeltranslation', interactive=False, failfast=False, verbosity=2) diff --git a/setup.py b/setup.py index 78ee10d..e0c4807 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ setup( 'wagtail_modeltranslation.migrate.management.commands'], package_data={'wagtail_modeltranslation': ['static/wagtail_modeltranslation/css/*.css', 'static/wagtail_modeltranslation/js/*.js']}, - install_requires=['wagtail>=1.4', 'django-modeltranslation>=0.13b1'], + install_requires=['wagtail>=1.8', 'django-modeltranslation>=0.13b1'], download_url='https://github.com/infoportugal/wagtail-modeltranslation/archive/v0.8.tar.gz', classifiers=[ 'Programming Language :: Python', diff --git a/wagtail_modeltranslation/patch_wagtailadmin.py b/wagtail_modeltranslation/patch_wagtailadmin.py index bab8fae..ce61762 100644 --- a/wagtail_modeltranslation/patch_wagtailadmin.py +++ b/wagtail_modeltranslation/patch_wagtailadmin.py @@ -27,6 +27,7 @@ try: from wagtail.core.models import Page, Site from wagtail.core.fields import StreamField, StreamValue from wagtail.core.url_routing import RouteResult + from wagtail.core.utils import WAGTAIL_APPEND_SLASH from wagtail.images.edit_handlers import ImageChooserPanel from wagtail.search.index import SearchField from wagtail.snippets.models import get_snippet_models @@ -38,17 +39,11 @@ except ImportError: from wagtail.wagtailcore.models import Page, Site from wagtail.wagtailcore.fields import StreamField, StreamValue from wagtail.wagtailcore.url_routing import RouteResult + from wagtail.wagtailcore.utils import WAGTAIL_APPEND_SLASH from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.wagtailsearch.index import SearchField from wagtail.wagtailsnippets.models import get_snippet_models from wagtail.wagtailsnippets.views.snippets import SNIPPET_EDIT_HANDLERS -try: - from wagtail.core.utils import WAGTAIL_APPEND_SLASH -except ImportError: - try: - from wagtail.wagtailcore.utils import WAGTAIL_APPEND_SLASH - except ImportError: - WAGTAIL_APPEND_SLASH = True # Wagtail<1.5 from wagtail_modeltranslation.settings import CUSTOM_SIMPLE_PANELS, CUSTOM_COMPOSED_PANELS from wagtail_modeltranslation.utils import compare_class_tree_depth diff --git a/wagtail_modeltranslation/tests/tests.py b/wagtail_modeltranslation/tests/tests.py index 15a1ed6..87851db 100755 --- a/wagtail_modeltranslation/tests/tests.py +++ b/wagtail_modeltranslation/tests/tests.py @@ -12,10 +12,7 @@ from django.test.client import RequestFactory from django.test.utils import override_settings from django.utils.translation import get_language, trans_real from modeltranslation import settings as mt_settings, translator -try: - from wagtail import VERSION -except ImportError: - VERSION = 1, 6, 3 # assume it's 1.6.3, the latest version without VERSION +from wagtail import VERSION from .util import page_factory from wagtail_modeltranslation.tests.test_settings import TEST_SETTINGS @@ -47,8 +44,7 @@ class WagtailModeltranslationTransactionTestBase(TransactionTestCase): if not WagtailModeltranslationTransactionTestBase.synced: # In order to perform only one syncdb WagtailModeltranslationTransactionTestBase.synced = True - mgr = (override_settings(**TEST_SETTINGS) if django.VERSION < (1, 8) - else dummy_context_mgr()) + mgr = dummy_context_mgr() with mgr: # 1. Reload translation in case USE_I18N was False from django.utils import translation as dj_trans @@ -324,7 +320,7 @@ class WagtailModeltranslationTest(WagtailModeltranslationTestBase): page_edit_handler = models.InlinePanelPage.get_edit_handler() - if VERSION[0] < 2: + if VERSION < (2,): form = page_edit_handler.get_form_class(models.InlinePanelPage) else: form = page_edit_handler.get_form_class() @@ -363,7 +359,7 @@ class WagtailModeltranslationTest(WagtailModeltranslationTestBase): from wagtail.wagtailsnippets.views.snippets import get_snippet_edit_handler snippet_edit_handler = get_snippet_edit_handler(models.InlinePanelSnippet) - if VERSION[0] < 2: + if VERSION < (2,): form = snippet_edit_handler.get_form_class(models.InlinePanelSnippet) else: form = snippet_edit_handler.get_form_class()