From 496ae12fa9bf97451e0fea4509d18822674906cc Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Thu, 15 May 2025 13:46:50 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F(backend)=20remove=20lazy=20f?= =?UTF-8?q?rom=20languages=20field=20on=20User=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea behind wrapping choices in `lazy` function was to allow overriding the list of languages in tests with `override_settings`. This was causing makemigrations to keep on including the field in migrations when it is not needed. Since we finally don't override the LANGUAGES setting in tests, we can remove it to fix the problem. Taken from docs #c882f13 --- src/backend/core/models.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/backend/core/models.py b/src/backend/core/models.py index 7db9d83b..aa5f7f5a 100644 --- a/src/backend/core/models.py +++ b/src/backend/core/models.py @@ -14,7 +14,6 @@ from django.core import mail, validators from django.core.exceptions import PermissionDenied, ValidationError from django.db import models from django.utils import timezone -from django.utils.functional import lazy from django.utils.text import capfirst, slugify from django.utils.translation import gettext_lazy as _ @@ -164,7 +163,7 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin): ) language = models.CharField( max_length=10, - choices=lazy(lambda: settings.LANGUAGES, tuple)(), + choices=settings.LANGUAGES, default=settings.LANGUAGE_CODE, verbose_name=_("language"), help_text=_("The language in which the user wants to see the interface."),