API: Validate input locales (Z#23182219) (#4833)

This commit is contained in:
Raphael Michel
2025-02-12 12:50:13 +01:00
committed by GitHub
parent 943193e8e0
commit 7afe2e66d7
5 changed files with 26 additions and 1 deletions

View File

@@ -22,6 +22,7 @@
import logging
from decimal import Decimal
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.utils.crypto import get_random_string
@@ -77,6 +78,7 @@ class CustomerSerializer(I18nAwareModelSerializer):
last_login = serializers.DateTimeField(read_only=True)
date_joined = serializers.DateTimeField(read_only=True)
last_modified = serializers.DateTimeField(read_only=True)
locale = serializers.ChoiceField(choices=settings.LANGUAGES, default='en')
class Meta:
model = Customer