#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)
Change History (9)
comment:1 by , 16 years ago
milestone: | 1.0.3 → 1.1 |
---|
comment:2 by , 16 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 16 years ago
Attachment: | partial_modelform_note.diff added |
---|
comment:3 by , 16 years ago
Triage Stage: | Accepted → Ready 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 , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:5 by , 16 years ago
Has patch: | set |
---|
comment:6 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Docs patch