Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strip forward slash #9

Merged
merged 8 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion history/__init__.py
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion history/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}),
Expand Down
4 changes: 3 additions & 1 deletion history/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
)
12 changes: 6 additions & 6 deletions history/management/commands/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion history/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading