Opened 14 years ago

Closed 9 years ago

Last modified 9 years ago

#13015 closed Bug (fixed)

Language regarding ModelForms with instances attached vs. bound Forms is unclear

Reported by: Wedg Owned by: Tim Graham
Component: Documentation Version: dev
Severity: Normal Keywords:
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

I discovered that providing initial via the field = FormField(initial='foobar') method and form = ModelForm(initial={'field':'method'}) behaves differently when the ModelForm is attached to a difference.

The documentation refers to a model instance bound to a form (at least in one location: http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/#overriding-the-clean-method).

And also the documentation describing initial (both for fields and Forms) says that it only provides a value for unbound forms.

Perhaps we could clarify the language to say that an instance is attached to a ModelForm, but the form itself is unbound - and maybe yet further explain that any initial= values for a FormField will be overridden by the values from an attached model instance, which in turn will be overridden by any initial= values provided to the ModelForm at runtime.

Change History (11)

in reply to:  description comment:1 by Wedg, 14 years ago

Replying to Wedg:

I discovered that providing initial via the field = FormField(initial='foobar') method and form = ModelForm(initial={'field':'method'}) behaves differently when the ModelForm is attached to a difference.

This should read "attached to an instance." This is what no sleep gets you. I apologize.

comment:2 by Chris Beaven, 14 years ago

Triage Stage: UnreviewedAccepted

Yes, the model form documentation's use of an instance being "bound" to a form is confusing at best.

comment:3 by Luke Plant, 13 years ago

Type: Bug

comment:4 by Luke Plant, 13 years ago

Severity: Normal

comment:5 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 by Aymeric Augustin, 12 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 by Tim Graham, 9 years ago

Has patch: set
Owner: changed from nobody to Tim Graham
Status: newassigned

comment:8 by Claude Paroz, 9 years ago

Triage Stage: AcceptedReady for checkin

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

Resolution: fixed
Status: assignedclosed

In a40a34a4b2d79dbf798df538c26222148d42b17c:

Fixed #13015 -- Clarified language about model instances attached to forms.

comment:10 by Tim Graham <timograham@…>, 9 years ago

In cc525e31bba1951a81eae3d2bf8625eeb14eb0a1:

[1.8.x] Fixed #13015 -- Clarified language about model instances attached to forms.

Backport of a40a34a4b2d79dbf798df538c26222148d42b17c from master

comment:11 by Tim Graham <timograham@…>, 9 years ago

In 5ebe921a8e4ea947580467b904105e14cbef3071:

[1.7.x] Fixed #13015 -- Clarified language about model instances attached to forms.

Backport of a40a34a4b2d79dbf798df538c26222148d42b17c from master

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