mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Fixed #34180 -- Added note about resetting language in test tear-downs.
Co-authored-by: Faris Naimi <farisfaris66@gmail.com>
This commit is contained in:
parent
20a0850099
commit
40217d1a82
1
AUTHORS
1
AUTHORS
@ -330,6 +330,7 @@ answer newbie questions, and generally made Django that much better:
|
||||
Florian Apolloner <florian@apolloner.eu>
|
||||
Florian Demmer <fdemmer@gmail.com>
|
||||
Florian Moussous <florian.moussous@gmail.com>
|
||||
fnaimi66 <https://github.com/fnaimi66>
|
||||
Fran Hrženjak <fran.hrzenjak@gmail.com>
|
||||
Francesco Panico <panico.francesco@gmail.com>
|
||||
Francisco Albarran Cristobal <pahko.xd@gmail.com>
|
||||
|
@ -685,6 +685,14 @@ or by including the ``Accept-Language`` HTTP header in the request::
|
||||
response = self.client.get("/", headers={"accept-language": "fr"})
|
||||
self.assertEqual(response.content, b"Bienvenue sur mon site.")
|
||||
|
||||
.. note::
|
||||
|
||||
When using these methods, ensure to reset the active language at the end of
|
||||
each test::
|
||||
|
||||
def tearDown(self):
|
||||
translation.activate(settings.LANGUAGE_CODE)
|
||||
|
||||
More details are in :ref:`how-django-discovers-language-preference`.
|
||||
|
||||
If the middleware isn't enabled, the active language may be set using
|
||||
|
Loading…
Reference in New Issue
Block a user