Skip to content

Commit

Permalink
Add support for Django 4.1 and Python 3.11 in CI, fix middleware init…
Browse files Browse the repository at this point in the history
…ialization issue.
  • Loading branch information
Benedikt Willi committed Jun 9, 2023
1 parent 6b634a5 commit 7f7d2d0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build:
Expand All @@ -26,6 +27,9 @@ jobs:
- python-version: "3.8"
django-version: Django==4.0

- python-version: "3.8"
django-version: Django==4.1

- python-version: "3.8"
django-version: Django==4.2

Expand All @@ -38,6 +42,9 @@ jobs:
- python-version: "3.9"
django-version: Django==4.0

- python-version: "3.9"
django-version: Django==4.1

- python-version: "3.9"
django-version: Django==4.2

Expand All @@ -47,9 +54,15 @@ jobs:
- python-version: "3.10"
django-version: Django==4.0

- python-version: "3.10"
django-version: Django==4.1

- python-version: "3.10"
django-version: Django==4.2

- python-version: "3.11"
django-version: Django==3.1

- python-version: "3.11"
django-version: Django==4.2

Expand Down
4 changes: 2 additions & 2 deletions tos/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class UserAgreementMiddleware(MiddlewareMixin):
Some middleware to check if users have agreed to the latest TOS
"""

def __init__(self, get_response=None):
self.get_response = get_response
def __init__(self, get_response):
super().__init__(get_response)

def process_request(self, request):
if self.should_fast_skip(request):
Expand Down
3 changes: 2 additions & 1 deletion tos/tests/test_middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME, get_user_model
from django.core.cache import caches
from django.http import HttpResponse
from django.test import TestCase
from django.test.utils import modify_settings
from django.urls import reverse
Expand Down Expand Up @@ -146,7 +147,7 @@ class Request(object):
def is_ajax(self):
return True

mw = UserAgreementMiddleware()
mw = UserAgreementMiddleware(HttpResponse())

response = mw.process_request(Request())

Expand Down

0 comments on commit 7f7d2d0

Please sign in to comment.