Skip to content

Commit

Permalink
Merge pull request #169 from ticosax/pre-commit-django-upgrade
Browse files Browse the repository at this point in the history
Add django-upgrade to our pre-commit checks
  • Loading branch information
ticosax authored Apr 5, 2023
2 parents d29ed3f + 11715e2 commit d27ed8c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
9 changes: 2 additions & 7 deletions django_fsm_log/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 1 addition & 3 deletions tests/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from .models import Article


@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
inlines = [StateLogInline]


admin.site.register(Article, ArticleAdmin)
6 changes: 1 addition & 5 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
13 changes: 3 additions & 10 deletions tests/urls.py
Original file line number Diff line number Diff line change
@@ -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)]

0 comments on commit d27ed8c

Please sign in to comment.