pythondotorg icon indicating copy to clipboard operation
pythondotorg copied to clipboard

Tests: Language chooser middleware warning during tests

Open JacobCoffee opened this issue 6 months ago • 3 comments

Investigate separately these non-failing warnings

......................../usr/local/lib/python3.12/site-packages/admin_interface/templatetags/admin_interface_tags.py:29: UserWarning: Language chooser requires 'django.middleware.locale.LocaleMiddleware' in your MIDDLEWARE to work.
  warnings.warn(
............................................................/usr/local/lib/python3.12/site-packages/admin_interface/templatetags/admin_interface_tags.py:29: UserWarning: Language chooser requires 'django.middleware.locale.LocaleMiddleware' in your MIDDLEWARE to work.
  warnings.warn(
../usr/local/lib/python3.12/site-packages/admin_interface/templatetags/admin_interface_tags.py:29: UserWarning: Language chooser requires 'django.middleware.locale.LocaleMiddleware' in your MIDDLEWARE to work.
  warnings.warn

Originally posted by @JacobCoffee in https://github.com/python/pythondotorg/issues/2741#issuecomment-2970938066

JacobCoffee avatar Jun 13 '25 16:06 JacobCoffee

Hi @JacobCoffee , I'd like to request assignment to this issue. I'm building experience in Python/Django through open source contributions and this looks like a great learning opportunity. My understanding: The admin_interface package is throwing warnings because it expects LocaleMiddleware in the MIDDLEWARE settings for its language chooser functionality. The solution would be to either add the required middleware or configure the package to disable the language chooser if internationalization isn't needed. Thanks! Emmanuel. P.S I am working full time so please let me know if there is a deadline to work towards

EmmanuelBerkowicz avatar Jul 06 '25 23:07 EmmanuelBerkowicz

Hi @JacobCoffee, The warnings were due to missing pieces:

  1. LocaleMiddleware in the middleware stack
  2. The set_language URL in the root URLConf I’ve added both locally and the warnings are gone. If nobody else is working on this, would it be alright if I open a PR with the fix?

kimyag avatar Aug 20 '25 22:08 kimyag

Hi @JacobCoffee 👋 I noticed that outbound links take more than 5 seconds to navigate to. You might find our free AI Dev Toolkit helpful – it can auto-fix bugs, generate docs, and optimize code in seconds: https://rapidapi.com/mimi800-mimi800-default/api/master-dev-api

mimi800-debug avatar Sep 19 '25 18:09 mimi800-debug

@JacobCoffee Hi , Is this issue still open I would like to work on this please let me know!

prabhath004 avatar Oct 30 '25 15:10 prabhath004