﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31911	Django-3.1: get_language() fails to return LANGUAGE_CODE during ./manage.py migrate	George Tantiras	nobody	"When in the `project/urls.py` another `urls.py` is included, `./manage.py migrate` forces `get_language` to return `None` instead of `settings.LANGUAGE_CODE`. 

Only in `Django-3.1`. More specifically:

This is how `get_language` is used:

{{{

class PendingConsentForm(forms.ModelForm):
    class Meta:
        model = Term
        fields = (
            ""summary_{0}"".format(get_language()),
        )
}}}


* Python-3.8.5 
* Django-3.1
* This is the simple failing project: https://github.com/raratiru/django-fail-language

**Steps to reproduce:**

* Fresh Django-3.1 install
* `pip install --index-url https://test.pypi.org/simple/ django-fail-language`
* Add `'letsagree',` in `INSTALLED_APPS` of `project/settings.py`
* Include `letsagree.urls` in `project/urls.py`:


{{{
urlpatterns = [
   ...
    path('', include('letsagree.urls')),
   ...
]
}}}

* `./manage.py migrate` fails with: `django.core.exceptions.FieldError: Unknown field(s) (summary_None) specified for Term`.
* `./manage.py makemigrations` will correctly return the value of `settings.LANGUAGE_CODE`: 
`django.core.exceptions.FieldError: Unknown field(s) (summary_en-us) specified for Term`

* In a virtualenv with `Django-3.0` `./manage.py migrate` will behave as expected:

`django.core.exceptions.FieldError: Unknown field(s) (summary_en-us) specified for Term`: 
Expected because `en-us` is the default for `settings.LANGUAGE_CODE`.



"	Bug	closed	Internationalization	3.1	Normal	invalid		Claude Paroz Simon Charette	Unreviewed	0	0	0	0	0	0
