diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d9994d..c6ff937 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,8 @@ jobs: - 5432:5432 strategy: matrix: - django-version: [2.2, 3.1, 3.2] - python-version: [3.6, 3.7, 3.8, 3.9] + django-version: [3.2, 4.2] + python-version: [3.8, 3.9, 3.11] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/history/__init__.py b/history/__init__.py index 529a615..dbbd49f 100644 --- a/history/__init__.py +++ b/history/__init__.py @@ -1,4 +1,4 @@ -__version_info__ = (2, 0, 1) +__version_info__ = (2, 0, 2) __version__ = ".".join(str(i) for i in __version_info__) default_app_config = "history.apps.HistoryConfig" diff --git a/history/admin.py b/history/admin.py index 74da7dd..3be6514 100644 --- a/history/admin.py +++ b/history/admin.py @@ -47,7 +47,7 @@ def show_history(self, request, queryset, extra_context=None): **self.admin_site.each_context(request), "use_json": USE_JSON, "history": object_history, - "title": f"{ model_class.__name__ } History", + "title": f"{model_class.__name__} History", "opts": model_class._meta, "queryset": queryset, **(extra_context or {}), diff --git a/history/conf.py b/history/conf.py index 2f64a2f..9e907a8 100644 --- a/history/conf.py +++ b/history/conf.py @@ -33,5 +33,7 @@ # A list of path prefixes the history middleware should ignore. MIDDLEWARE_IGNORE = getattr( - settings, "HISTORY_MIDDLEWARE_IGNORE", [settings.STATIC_URL, settings.MEDIA_URL] + settings, + "HISTORY_MIDDLEWARE_IGNORE", + [settings.STATIC_URL, settings.MEDIA_URL], ) diff --git a/history/management/commands/triggers.py b/history/management/commands/triggers.py index 8ebb53d..dcf1679 100644 --- a/history/management/commands/triggers.py +++ b/history/management/commands/triggers.py @@ -223,9 +223,9 @@ def create_history_table(cursor, base_table, pk_name, pk_type): "schema": conf.SCHEMA_NAME, "table": history_table, "role": conf.DB_ROLE, - "timestamp_type": "timestamp with time zone" - if conf.USE_TIMEZONES - else "timestamp", + "timestamp_type": ( + "timestamp with time zone" if conf.USE_TIMEZONES else "timestamp" + ), "pk_name": pk_name, "pk_type": pk_type, "user_field": conf.USER_FIELD, @@ -450,9 +450,9 @@ def create_trigger(cursor, trigger_type, table_name, pk_name, table_schema="publ "history_user_field": conf.USER_FIELD, "return": "OLD" if trigger_type == "delete" else "NEW", "role": conf.DB_ROLE, - "timestamp_type": "timestamp with time zone" - if conf.USE_TIMEZONES - else "timestamp", + "timestamp_type": ( + "timestamp with time zone" if conf.USE_TIMEZONES else "timestamp" + ), "user_type": conf.USER_TYPE, "default_user": maybe_quote(conf.DEFAULT_USER), "default_user_error": "true" if conf.DEFAULT_USER_ERROR else "false", diff --git a/history/middleware.py b/history/middleware.py index 88d77e2..b1d744a 100644 --- a/history/middleware.py +++ b/history/middleware.py @@ -22,7 +22,7 @@ def __init__(self, get_response=None): def __call__(self, request): create_history = True for prefix in conf.MIDDLEWARE_IGNORE: - if prefix and request.path.startswith(prefix): + if prefix and prefix != "/" and request.path.startswith(prefix): create_history = False if create_history: