diff --git a/django/forms/formsets.py b/django/forms/formsets.py index 444c84c9d4..6400e4a67f 100644 --- a/django/forms/formsets.py +++ b/django/forms/formsets.py @@ -147,6 +147,9 @@ class BaseFormSet(object): def get_form_kwargs(self, index): """ Return additional keyword arguments for each individual formset form. + + index will be None if the form being constructed is a new empty + form. """ return self.form_kwargs.copy() diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index b101738d78..793dcd6a82 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -173,6 +173,9 @@ Forms * A form prefix can be specified inside a form class, not only when instantiating a form. See :ref:`form-prefix` for details. +* You can now :ref:`specify keyword arguments ` + that you want to pass to the constructor of forms in a formset. + Generic Views ^^^^^^^^^^^^^ diff --git a/docs/topics/forms/formsets.txt b/docs/topics/forms/formsets.txt index 97de9810e8..6d22118a40 100644 --- a/docs/topics/forms/formsets.txt +++ b/docs/topics/forms/formsets.txt @@ -535,6 +535,8 @@ default fields/attributes of the order and deletion fields:: +.. _custom-formset-form-kwargs: + Passing custom parameters to formset forms ------------------------------------------