Skip to content

Conversation

@njg7194
Copy link

@njg7194 njg7194 commented Feb 1, 2026

Summary

This PR adds django.middleware.locale.LocaleMiddleware to the MIDDLEWARE setting to resolve the warning that appears during test runs.

Changes

  • Added LocaleMiddleware after SessionMiddleware in pydotorg/settings/base.py

Issue

Fixes #2742

Context

The admin_interface package's language chooser feature requires LocaleMiddleware to be present in the MIDDLEWARE setting. Without it, a warning is raised:

UserWarning: Language chooser requires 'django.middleware.locale.LocaleMiddleware' in your MIDDLEWARE to work.

The middleware is placed after SessionMiddleware as per Django's documentation, which recommends it be positioned early, but after SessionMiddleware.

This fixes the UserWarning about Language chooser requiring
'django.middleware.locale.LocaleMiddleware' in MIDDLEWARE.

Fixes python#2742
@njg7194 njg7194 requested a review from JacobCoffee as a code owner February 1, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests: Language chooser middleware warning during tests

1 participant