Skip to content

Commit d1c69a0

Browse files
authored
strip forward slash (#9)
* strip forward slash * run black * flake8 * Update implementation to just skip forward slash prefix * run black * Update ci.yml * Update ci.yml part 2 * Bump version
1 parent a242752 commit d1c69a0

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
- 5432:5432
3838
strategy:
3939
matrix:
40-
django-version: [2.2, 3.1, 3.2]
41-
python-version: [3.6, 3.7, 3.8, 3.9]
40+
django-version: [3.2, 4.2]
41+
python-version: [3.8, 3.9, 3.11]
4242
steps:
4343
- uses: actions/checkout@v2
4444
- name: Set up Python ${{ matrix.python-version }}

history/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version_info__ = (2, 0, 1)
1+
__version_info__ = (2, 0, 2)
22
__version__ = ".".join(str(i) for i in __version_info__)
33

44
default_app_config = "history.apps.HistoryConfig"

history/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def show_history(self, request, queryset, extra_context=None):
4747
**self.admin_site.each_context(request),
4848
"use_json": USE_JSON,
4949
"history": object_history,
50-
"title": f"{ model_class.__name__ } History",
50+
"title": f"{model_class.__name__} History",
5151
"opts": model_class._meta,
5252
"queryset": queryset,
5353
**(extra_context or {}),

history/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,7 @@
3333

3434
# A list of path prefixes the history middleware should ignore.
3535
MIDDLEWARE_IGNORE = getattr(
36-
settings, "HISTORY_MIDDLEWARE_IGNORE", [settings.STATIC_URL, settings.MEDIA_URL]
36+
settings,
37+
"HISTORY_MIDDLEWARE_IGNORE",
38+
[settings.STATIC_URL, settings.MEDIA_URL],
3739
)

history/management/commands/triggers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ def create_history_table(cursor, base_table, pk_name, pk_type):
223223
"schema": conf.SCHEMA_NAME,
224224
"table": history_table,
225225
"role": conf.DB_ROLE,
226-
"timestamp_type": "timestamp with time zone"
227-
if conf.USE_TIMEZONES
228-
else "timestamp",
226+
"timestamp_type": (
227+
"timestamp with time zone" if conf.USE_TIMEZONES else "timestamp"
228+
),
229229
"pk_name": pk_name,
230230
"pk_type": pk_type,
231231
"user_field": conf.USER_FIELD,
@@ -450,9 +450,9 @@ def create_trigger(cursor, trigger_type, table_name, pk_name, table_schema="publ
450450
"history_user_field": conf.USER_FIELD,
451451
"return": "OLD" if trigger_type == "delete" else "NEW",
452452
"role": conf.DB_ROLE,
453-
"timestamp_type": "timestamp with time zone"
454-
if conf.USE_TIMEZONES
455-
else "timestamp",
453+
"timestamp_type": (
454+
"timestamp with time zone" if conf.USE_TIMEZONES else "timestamp"
455+
),
456456
"user_type": conf.USER_TYPE,
457457
"default_user": maybe_quote(conf.DEFAULT_USER),
458458
"default_user_error": "true" if conf.DEFAULT_USER_ERROR else "false",

history/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, get_response=None):
2222
def __call__(self, request):
2323
create_history = True
2424
for prefix in conf.MIDDLEWARE_IGNORE:
25-
if prefix and request.path.startswith(prefix):
25+
if prefix and prefix != "/" and request.path.startswith(prefix):
2626
create_history = False
2727

2828
if create_history:

0 commit comments

Comments
 (0)