diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d7c45bf..bfd274e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,3 +29,8 @@ repos: - "--line-length" - "119" exclude: ^django_fsm_log/migrations|^docs/ + - repo: https://github.com/adamchainz/django-upgrade + rev: "1.13.0" + hooks: + - id: django-upgrade + args: [--target-version, "3.2"] diff --git a/django_fsm_log/backends.py b/django_fsm_log/backends.py index 8b79964..fe4dfeb 100644 --- a/django_fsm_log/backends.py +++ b/django_fsm_log/backends.py @@ -83,13 +83,8 @@ def post_transition_callback(sender, instance, name, source, target, **kwargs): if settings.DJANGO_FSM_LOG_STORAGE_METHOD == "django_fsm_log.backends.CachedBackend": - try: - from django.core.cache import caches - except ImportError: - from django.core.cache import get_cache # Deprecated, removed in 1.9. + from django.core.cache import caches - cache = get_cache(settings.DJANGO_FSM_LOG_CACHE_BACKEND) - else: - cache = caches[settings.DJANGO_FSM_LOG_CACHE_BACKEND] + cache = caches[settings.DJANGO_FSM_LOG_CACHE_BACKEND] else: cache = None diff --git a/tests/admin.py b/tests/admin.py index ec0c9de..9e240ac 100644 --- a/tests/admin.py +++ b/tests/admin.py @@ -5,8 +5,6 @@ from .models import Article +@admin.register(Article) class ArticleAdmin(admin.ModelAdmin): inlines = [StateLogInline] - - -admin.site.register(Article, ArticleAdmin) diff --git a/tests/test_admin.py b/tests/test_admin.py index 70c8b5e..793598a 100644 --- a/tests/test_admin.py +++ b/tests/test_admin.py @@ -1,8 +1,4 @@ -try: - from django.urls import reverse -except ImportError: - # django<=1.10 - from django.core.urlresolvers import reverse +from django.urls import reverse def test_state_log_inline_django2(article, admin_client, admin_user): diff --git a/tests/urls.py b/tests/urls.py index 57271b6..9fdc83d 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,11 +1,4 @@ -try: - from django.contrib import admin - from django.urls import path +from django.contrib import admin +from django.urls import path - urlpatterns = [path("admin", admin.site.urls)] -except ImportError: - # django < 2.0 - from django.conf.urls import include, url - from django.contrib import admin - - urlpatterns = [url(r"^admin/", include(admin.site.urls))] +urlpatterns = [path("admin", admin.site.urls)]