* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Thanks for the report. As far as I understand correctly, you have a
subclass of `SelectMultiple` with `allow_multiple_selected` set to
`False`, that's quite niche. However, I agree that we should check
`allow_multiple_selected` in both places:
{{{#!diff
diff --git a/django/contrib/admin/options.py
b/django/contrib/admin/options.py
index a25814b5fb..f959a8dc48 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -314,8 +314,12 @@ class
BaseModelAdmin(metaclass=forms.MediaDefiningClass):
kwargs["queryset"] = queryset
form_field = db_field.formfield(**kwargs)
- if isinstance(form_field.widget, SelectMultiple) and not
isinstance(
- form_field.widget, (CheckboxSelectMultiple,
AutocompleteSelectMultiple)
+ if (
+ isinstance(form_field.widget, SelectMultiple)
+ and form_field.widget.allow_multiple_selected
+ and not isinstance(
+ form_field.widget, (CheckboxSelectMultiple,
AutocompleteSelectMultiple)
+ )
):
msg = _(
"Hold down “Control”, or “Command” on a Mac, to select
more than one."
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33805#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.