summaryrefslogtreecommitdiff
path: root/django/forms/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/forms/models.py')
-rw-r--r--django/forms/models.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index a53f119995..9686baa6f2 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -12,7 +12,7 @@ from django.core.exceptions import (
ValidationError,
)
from django.core.validators import ProhibitNullCharactersValidator
-from django.db.models.utils import AltersData
+from django.db.models.utils import AltersData, get_blank_choice_label
from django.forms.fields import ChoiceField, Field
from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass
from django.forms.formsets import BaseFormSet, formset_factory
@@ -1481,7 +1481,7 @@ class ModelChoiceField(ChoiceField):
self,
queryset,
*,
- empty_label="---------",
+ empty_label="",
required=True,
widget=None,
label=None,
@@ -1508,6 +1508,8 @@ class ModelChoiceField(ChoiceField):
):
self.empty_label = None
else:
+ if empty_label == "":
+ empty_label = get_blank_choice_label()
self.empty_label = empty_label
self.queryset = queryset
self.limit_choices_to = limit_choices_to # limit the queryset later.