Language regarding ModelForms with instances attached vs. bound Forms is unclear
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)
Triage Stage: |
Unreviewed → Accepted
|
Has patch: |
set
|
Owner: |
changed from nobody to Tim Graham
|
Status: |
new → assigned
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Replying to Wedg:
This should read "attached to an instance." This is what no sleep gets you. I apologize.