Opened 16 years ago

Closed 15 years ago

Last modified 13 years ago

#10845 closed (fixed)

The use of "Instance" in "Creating Forms from Models" is confusing.

Reported by: ElfSternberg Owned by: Jacob
Component: Documentation Version: 1.0
Severity: Keywords: grammar
Cc: 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

In the section "Using a subset of fields on a form," the example contains the text:

instance = Instance(required_field='value')
form = InstanceForm(request.POST, instance=instance)

The use of "instance" here as the lvalue of Instance is a poor choice. For someone skimming through the article looking just for the syntax for a subset of fields on a form, and who may have missed the text earlier in the article about the instance keyword, this seems to imply that the keyword argument might be some lowercase variant of the Model name. I strongly suggest an alternative example:

example = Example(required_field='value')
form = ExampleForm(request.POST, instance=example)

Which would make it much more clear that "instance" is the kwarg, and the kwarg is not generated dynamically.

Attachments (1)

partial_modelform_note.diff (1.1 KB ) - added by Andy Durdin 16 years ago.
Docs patch

Download all attachments as: .zip

Change History (9)

comment:1 by Alex Gaynor, 16 years ago

milestone: 1.0.31.1

comment:2 by Jacob, 16 years ago

Triage Stage: UnreviewedAccepted

by Andy Durdin, 16 years ago

Attachment: partial_modelform_note.diff added

Docs patch

comment:3 by Andy Durdin, 16 years ago

Triage Stage: AcceptedReady for checkin

Rather than use the meaningless names "Example", I used the same Author models as used in the docs up to this point for clarity.

comment:4 by Jacob, 16 years ago

Owner: changed from nobody to Jacob
Status: newassigned

comment:5 by Ramiro Morales, 15 years ago

Has patch: set

comment:6 by Russell Keith-Magee, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [10972]) Fixed #10845 -- Clarified the examples for using ModelForms with fields or exclude specified. Thanks to Andrew Durdin for the suggestion.

comment:7 by Russell Keith-Magee, 15 years ago

(In [10975]) [1.0.X] Fixed #10845 -- Clarified the examples for using ModelForms with fields or exclude specified. Thanks to Andrew Durdin for the suggestion.

Merge of r10972 from trunk.

comment:8 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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