diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index 04057a1..a2c886c 100644
|
a
|
b
|
class BaseFormSet(StrAndUnicode):
|
| 119 | 119 | if self.is_bound: |
| 120 | 120 | defaults['data'] = self.data |
| 121 | 121 | defaults['files'] = self.files |
| 122 | | if self.initial: |
| | 122 | if self.initial and not 'initial' in kwargs: |
| 123 | 123 | try: |
| 124 | 124 | defaults['initial'] = self.initial[i] |
| 125 | | except IndexError: |
| | 125 | except (IndexError, KeyError): |
| 126 | 126 | pass |
| 127 | 127 | # Allow extra forms to be empty. |
| 128 | 128 | if i >= self.initial_form_count(): |
diff --git a/django/forms/models.py b/django/forms/models.py
index 254cca3..1fbcefc 100644
|
a
|
b
|
class BaseModelFormSet(BaseFormSet):
|
| 447 | 447 | kwargs['instance'] = self._existing_object(pk) |
| 448 | 448 | if i < self.initial_form_count() and not kwargs.get('instance'): |
| 449 | 449 | kwargs['instance'] = self.get_queryset()[i] |
| | 450 | if i >= self.initial_form_count() and self.initial: |
| | 451 | # Set initial values for extra forms |
| | 452 | try: |
| | 453 | kwargs['initial'] = self.initial[i-self.initial_form_count()] |
| | 454 | except IndexError: |
| | 455 | pass |
| 450 | 456 | return super(BaseModelFormSet, self)._construct_form(i, **kwargs) |
| 451 | 457 | |
| 452 | 458 | def get_queryset(self): |
diff --git a/docs/topics/forms/modelforms.txt b/docs/topics/forms/modelforms.txt
index 07c7b02..79a0345 100644
|
a
|
b
|
exclude::
|
| 613 | 613 | |
| 614 | 614 | >>> AuthorFormSet = modelformset_factory(Author, exclude=('birth_date',)) |
| 615 | 615 | |
| | 616 | Providing initial values |
| | 617 | ------------------------ |
| | 618 | |
| | 619 | Like with regular formsets, it is possible to specify initial data for forms |
| | 620 | in the formset. However, with model formsets the initial values only apply to |
| | 621 | extra forms, those which are not bound with an existing object instance. |
| | 622 | |
| | 623 | |
| 616 | 624 | .. _saving-objects-in-the-formset: |
| 617 | 625 | |
| 618 | 626 | Saving objects in the formset |