From 63c56cda133a85a158502891c40465bc0331d3d9 Mon Sep 17 00:00:00 2001 From: Annabelle Wiegart Date: Sun, 18 Jan 2026 20:03:28 +0100 Subject: Fixed #35870 -- Made blank choice label in forms more accessible. Added new constant django.db.models.fields.BLANK_CHOICE_LABEL for an accessible and translatable blank choice label in forms. Deprecated django.db.models.fields.BLANK_CHOICE_DASH constant. Added the immediately deprecated transitional setting USE_BLANK_CHOICE_DASH. Co-Authored-By: Marijke Luttekes --- django/forms/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'django/forms/fields.py') diff --git a/django/forms/fields.py b/django/forms/fields.py index 8aad2d48b8..26640ed7d3 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -15,6 +15,7 @@ from io import BytesIO from django.core import validators from django.core.exceptions import ValidationError +from django.db.models.utils import get_blank_choice_label from django.forms.boundfield import BoundField from django.forms.utils import from_current_timezone, to_current_timezone from django.forms.widgets import ( @@ -1200,7 +1201,7 @@ class FilePathField(ChoiceField): if self.required: self.choices = [] else: - self.choices = [("", "---------")] + self.choices = [("", get_blank_choice_label())] if self.match is not None: self.match_re = re.compile(self.match) -- cgit v1.3