Opened 13 years ago
Closed 13 years ago
#17629 closed Bug (invalid)
forms.ChoiceField throws TypeError if label argument not provided
Reported by: | Daniel Greenfeld | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.3 |
Severity: | Normal | Keywords: | |
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 )
GRID_TYPE_CHOICES = (("comparison", "Comparison"), ("gallery", "Gallery"))
grid_type = forms.ChoiceField(_("Type"), choices=(("comparison", "Comparison"), ("gallery", "Gallery")) # throws a TypeError.
grid_type = forms.ChoiceField(label=_("Type"), choices=GRID_TYPE_CHOICES) # Works fine
Change History (2)
comment:1 by , 13 years ago
Description: | modified (diff) |
---|
comment:2 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
This isn't a bug, the error you're seeing is probably "__init__ got multiple values for keyword argument 'choices'"
, because choices is the first positional argument. You can't pass the label as a positional argument like that.
Note:
See TracTickets
for help on using tickets.
Formatted for readability, please use preview in the future.