Opened 5 years ago
Closed 4 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 )
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 , 5 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 5 years ago
| Description: | modified (diff) |
|---|
comment:3 by , 5 years ago
| Resolution: | → invalid |
|---|---|
| Severity: | Release blocker → Normal |
| Status: | new → closed |
| UI/UX: | unset |
comment:4 by , 5 years ago
| Summary: | forms.ModelMultipleChoiceField raising TypeError when empty_label provided → forms.ModelMultipleChoiceField raises TypeError with empty_label argument. |
|---|
comment:5 by , 4 years ago
| Resolution: | invalid |
|---|---|
| Status: | closed → new |
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.
comment:6 by , 4 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Please don't reopen closed ticket. This is not a bug, ModelMultipleChoiceField doesn't support empty_label (see docs).
ModelMultipleChoiceFielddoesn't supportempty_label(see docs).