diff options
| author | Tim Graham <timograham@gmail.com> | 2013-01-22 16:13:57 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-01-22 18:18:32 -0500 |
| commit | dc0bf53276f28421006d041dc21c7dc8d0393b2d (patch) | |
| tree | 56d99db894b3b5d51bc8c5fbd37f1519644e8464 /docs/ref | |
| parent | 34718395edec9aaf01443b7c9d89ebe14400721e (diff) | |
[1.5.x] Fixed #19477 - Documented generic_inlineformset_factory
Thanks epicserve for the suggestion.
Backport of 214fb700b9 from master
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/contenttypes.txt | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt index e9cd5e7bc0..282e350a64 100644 --- a/docs/ref/contrib/contenttypes.txt +++ b/docs/ref/contrib/contenttypes.txt @@ -452,14 +452,18 @@ need to calculate them without using the aggregation API. Generic relations in forms and admin ------------------------------------ -The :mod:`django.contrib.contenttypes.generic` module provides -``BaseGenericInlineFormSet``, -:class:`~django.contrib.contenttypes.generic.GenericTabularInline` -and :class:`~django.contrib.contenttypes.generic.GenericStackedInline` -(the last two are subclasses of -:class:`~django.contrib.contenttypes.generic.GenericInlineModelAdmin`). -This enables the use of generic relations in forms and the admin. See the -:doc:`model formset </topics/forms/modelforms>` and +The :mod:`django.contrib.contenttypes.generic` module provides: + +* ``BaseGenericInlineFormSet`` +* :class:`~django.contrib.contenttypes.generic.GenericTabularInline` + and :class:`~django.contrib.contenttypes.generic.GenericStackedInline` + (subclasses of + :class:`~django.contrib.contenttypes.generic.GenericInlineModelAdmin`) +* A formset factory, :func:`generic_inlineformset_factory`, for use with + :class:`GenericForeignKey` + +These classes and functions enable the use of generic relations in forms +and the admin. See the :doc:`model formset </topics/forms/modelforms>` and :ref:`admin <using-generic-relations-as-an-inline>` documentation for more information. @@ -486,3 +490,14 @@ information. Subclasses of :class:`GenericInlineModelAdmin` with stacked and tabular layouts, respectively. + +.. function:: generic_inlineformset_factory(model, form=ModelForm, formset=BaseGenericInlineFormSet, ct_field="content_type", fk_field="object_id", fields=None, exclude=None, extra=3, can_order=False, can_delete=True, max_num=None, formfield_callback=None) + + Returns a ``GenericInlineFormSet`` using + :func:`~django.forms.models.modelformset_factory`. + + You must provide ``ct_field`` and ``object_id`` if they different from the + defaults, ``content_type`` and ``object_id`` respectively. Other parameters + are similar to those documented in + :func:`~django.forms.models.modelformset_factory` and + :func:`~django.forms.models.inlineformset_factory`. |
