Opened 18 years ago
Closed 18 years ago
#3289 closed defect (fixed)
MultipleHiddenInput widget is missing "value_from_datadict" method.
Reported by: | anonymous | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Forms | Version: | dev |
Severity: | minor | 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
I have a custom field that handles multiple hidden integers. The field value is a list of integers.
Example:
>>> class DaForm(forms.Form): ... values = MultipleHiddenIntegerField() # My custom field. Custom "clean" method and "widget = forms.MultipleHiddenInput". >>> form = DaForm(initial={'values': [1, 2, 3]}) >>> print form <input type="hidden" name="values" value="1" id="id_values" /> <input type="hidden" name="values" value="2" id="id_values" /> <input type="hidden" name="values" value="3" id="id_values" /> >>> data = MultiValueDict() >>> data.setlist('values', ['1', '2', '3']) >>> form = DaForm(data) >>> print form <input type="hidden" name="values" value="3" id="id_values" />
As you can see, the last form does not print all inputs.
I have tracked this problem to the 'value_from_datadict' method. The class 'SelectMultiple' has a version that works perfectly.
The 'MultipleHiddenInput' widget needs this method.
Attachments (1)
Change History (2)
by , 18 years ago
Attachment: | widgets.diff added |
---|
comment:1 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Diff for quick fix of the problem