Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#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)

13997.diff (2.1 KB ) - added by Preston Timmons 14 years ago.
Documented using the Multiwidget with single value fields
13997.2.diff (2.6 KB ) - added by Preston Timmons 14 years ago.
Modified the docs with better example and gave example usage.
13997.3.diff (3.2 KB ) - added by Preston Timmons 14 years ago.
13997.4.diff (10.1 KB ) - added by Tim Graham 12 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 by Thejaswi Puthraya, 14 years ago

Component: UncategorizedDocumentation

comment:2 by Gabriel Hurley, 14 years ago

Triage Stage: UnreviewedAccepted

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.

comment:3 by Paul Oswald, 14 years ago

milestone: 1.3

by Preston Timmons, 14 years ago

Attachment: 13997.diff added

Documented using the Multiwidget with single value fields

comment:4 by Preston Timmons, 14 years ago

I added a patch with an example widget for using a MultiWidget with the us.forms.USPhoneNumberField in localflavor.

by Preston Timmons, 14 years ago

Attachment: 13997.2.diff added

Modified the docs with better example and gave example usage.

by Preston Timmons, 14 years ago

Attachment: 13997.3.diff added

comment:5 by Graham King, 14 years ago

Severity: Normal
Type: New feature

comment:6 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

comment:7 by Paul Collins, 13 years ago

Cc: paul.collins.iii@… added
Easy pickings: unset
UI/UX: unset

comment:8 by mjdemilliano@…, 12 years ago

Needs documentation: set
Version: 1.21.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 Tim Graham, 12 years ago

Has patch: set
Needs documentation: unset

comment:10 by Tim Graham, 12 years ago

Patch needs improvement: set
Summary: multiwidget needs better docsAdd 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 Tim Graham, 12 years ago

Attachment: 13997.4.diff added

comment:11 by Tim Graham, 12 years ago

Cc: timograham@… 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:12 by Jannis Leidel, 12 years ago

Triage Stage: AcceptedReady for checkin

Looks great!

comment:13 by Tim Graham <timograham@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 04775b4598d1a9c5bcc0c1da431e368f28dcd13e:

Fixed #13997 - Added an example of constructing a MultiWidget and documented the value_from_datadict method.

comment:14 by Tim Graham <timograham@…>, 12 years ago

In 31da2a5e56dba374279cc8276d9ccb2e3096e4a9:

[1.5.X] Fixed #13997 - Added an example of constructing a MultiWidget and documented the value_from_datadict method.

Backport of 04775b4598 from master

comment:15 by Tim Graham <timograham@…>, 12 years ago

In 06c14a63a2c27e5eddfbd6f7b35bcb1d0fc2882b:

[1.4.X] Fixed #13997 - Added an example of constructing a MultiWidget and documented the value_from_datadict method.

Backport of 04775b4598 from master

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