Skip to content

Commit

Permalink
Merge pull request #27 from thorgate/fix-locale-middleware
Browse files Browse the repository at this point in the history
Fix locale middleware
  • Loading branch information
jorgenader authored Jan 26, 2023
2 parents f6f85cd + 19307b0 commit 2fd419e
Show file tree
Hide file tree
Showing 13 changed files with 618 additions and 451 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Add poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.1.13"
poetry-version: "1.2.2"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Add poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.1.13"
poetry-version: "1.2.2"
- name: Install dependencies
run: poetry install
- name: Build and publish
Expand Down
2 changes: 2 additions & 0 deletions demo/example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"django.middleware.locale.LocaleMiddleware",
"tg_react.middleware.LocaleMiddleware",
]

ROOT_URLCONF = "example.urls"
Expand Down
6 changes: 6 additions & 0 deletions demo/example/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.http.response import HttpResponse
from django.urls import re_path, include
from django.utils import translation

from django.contrib import admin

Expand All @@ -10,8 +11,13 @@ def test_view(request):
return HttpResponse("Hello from test_view")


def test_language_view(request):
return HttpResponse(f"current_language: {translation.get_language()}")


urlpatterns = [
re_path(r"^admin/", admin.site.urls),
re_path(r"^test/", test_view, name="test_view"),
re_path(r"^test-language/", test_language_view, name="test_language_view"),
re_path(r"api/", include("tg_react.api.accounts.urls")),
]
Loading

0 comments on commit 2fd419e

Please sign in to comment.