Opened 3 years ago

Closed 3 years ago

#32341 closed Bug (invalid)

forms.ModelMultipleChoiceField raises TypeError with empty_label argument.

Reported by: thewamz Owned by: nobody
Component: Forms Version: 3.1
Severity: Normal Keywords: ModelMultipleChoiceField
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by thewamz)

In a django form, when I set a value for the empty_label parameter, a TypeError is raised. TypeError: init() got multiple values for keyword argument 'empty_label'

field_name = forms.ModelMultipleChoiceField(queryset=MyModel.objects.all(), empty_label="Select something")

Change History (6)

comment:1 by thewamz, 3 years ago

Description: modified (diff)

comment:2 by thewamz, 3 years ago

Description: modified (diff)

comment:3 by Mariusz Felisiak, 3 years ago

Resolution: invalid
Severity: Release blockerNormal
Status: newclosed
UI/UX: unset

ModelMultipleChoiceField doesn't support empty_label (see docs).

comment:4 by Mariusz Felisiak, 3 years ago

Summary: forms.ModelMultipleChoiceField raising TypeError when empty_label providedforms.ModelMultipleChoiceField raises TypeError with empty_label argument.

comment:5 by piscvau, 3 years ago

Resolution: invalid
Status: closednew

Hello
In version 3.8 of module forms line 1315 , The class ModelMultipleChoiceField.__init__ calls super().__init__ with empty_label = None. This a real bug easy to correct.

Last edited 3 years ago by Mariusz Felisiak (previous) (diff)

comment:6 by Mariusz Felisiak, 3 years ago

Resolution: invalid
Status: newclosed

Please don't reopen closed ticket. This is not a bug, ModelMultipleChoiceField doesn't support empty_label (see docs).

Note: See TracTickets for help on using tickets.
Back to Top