diff options
Diffstat (limited to 'docs/topics/forms')
| -rw-r--r-- | docs/topics/forms/formsets.txt | 2 | ||||
| -rw-r--r-- | docs/topics/forms/modelforms.txt | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index 37c3067f55..b524c24ad2 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -53,6 +53,8 @@ Formsets can also be indexed into, which returns the corresponding form. If you override ``__iter__``, you will need to also override ``__getitem__`` to have matching behavior. +.. _formsets-initial-data: + Using initial data with a formset --------------------------------- diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt index 832a3acff0..cd1f43ae49 100644 --- a/docs/topics/forms/modelforms.txt +++ b/docs/topics/forms/modelforms.txt @@ -617,6 +617,17 @@ exclude:: >>> AuthorFormSet = modelformset_factory(Author, exclude=('birth_date',)) +Providing initial values +------------------------ + +.. versionadded:: 1.4 + +As with regular formsets, it is possible to :ref:`specify initial data +<formsets-initial-data>` for forms in the formset by specifying an ``initial`` +parameter when instantiating the model formset class returned by +``modelformset_factory``. However, with model formsets the initial values only +apply to extra forms, those which are not bound to an existing object instance. + .. _saving-objects-in-the-formset: Saving objects in the formset |
