#13997 closed New feature (fixed)
Add an example of constructing a MultiWidget and document the value_from_datadict method
Reported by: | cuci | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | paul.collins.iii@…, timograham@… | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've been trying to get a multiwidget but I could only see some(old) example on net, none in official docs...preatty hard to do without docs.
Attachments (4)
Change History (19)
comment:1 by , 14 years ago
Component: | Uncategorized → Documentation |
---|
comment:2 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 14 years ago
milestone: | → 1.3 |
---|
by , 14 years ago
Attachment: | 13997.diff added |
---|
Documented using the Multiwidget with single value fields
comment:4 by , 14 years ago
I added a patch with an example widget for using a MultiWidget with the us.forms.USPhoneNumberField in localflavor.
by , 14 years ago
Attachment: | 13997.2.diff added |
---|
Modified the docs with better example and gave example usage.
by , 14 years ago
Attachment: | 13997.3.diff added |
---|
comment:5 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:7 by , 13 years ago
Cc: | added |
---|---|
Easy pickings: | unset |
UI/UX: | unset |
comment:8 by , 12 years ago
Needs documentation: | set |
---|---|
Version: | 1.2 → 1.4 |
It would be helpful if the documentation on MultiWidget also brought the method value_from_datadict
to the attention, next to decompress
, to also have the transformation from multiple widget values to the field value (decompress
does the reverse).
Example:
def value_from_datadict(self, data, files, name): values = super(MyMultiWidget, self).value_from_datadict(data, files, name) # i.e. return MyValueType(float(values[0]), float(values[1])) return MyValueType(... something with values ...)
comment:9 by , 12 years ago
Has patch: | set |
---|---|
Needs documentation: | unset |
comment:10 by , 12 years ago
Patch needs improvement: | set |
---|---|
Summary: | multiwidget needs better docs → Add an example of constructing a MultiWidget and document the value_from_datadict method |
We probably shouldn't use localflavor as an example at this point since it's being broken out into a separate package.
by , 12 years ago
Attachment: | 13997.4.diff added |
---|
comment:11 by , 12 years ago
Cc: | added |
---|---|
Patch needs improvement: | unset |
I've added a patch that combines the two existing MultiWidget sections, documents value_from_datadict, and adds an example MultiWidget with an explanation of each method.
comment:13 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
One sentence certainly isn't all that should be said about MultiWidget. It probably warrants a whole "Constructing A MultiWidget" section at the end of that page, complete with explanation and an example.