diff options
| author | Gavin Wahl <gwahl@fusionbox.com> | 2013-05-20 11:51:05 -0600 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2013-05-23 19:03:14 -0400 |
| commit | 48424adaba74379eee311b3d1519f011212357ad (patch) | |
| tree | e038270882eca666181d8fbde8cd13381857f4cd /docs | |
| parent | 8dda8a5ecc8f481364dc8f58b4ba319e5b016679 (diff) | |
Fixed #17648 -- Add `for_concrete_model` to `GenericForeignKey`.
Allows a `GenericForeignKey` to reference proxy models. The default
for `for_concrete_model` is `True` to keep backwards compatibility.
Also added the analog `for_concrete_model` kwarg to
`generic_inlineformset_factory` to provide an API at the form level.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/contenttypes.txt | 17 | ||||
| -rw-r--r-- | docs/releases/1.6.txt | 5 |
2 files changed, 21 insertions, 1 deletions
diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt index 1bb0802442..de9c5dcbd6 100644 --- a/docs/ref/contrib/contenttypes.txt +++ b/docs/ref/contrib/contenttypes.txt @@ -303,6 +303,15 @@ model: :class:`~django.contrib.contenttypes.generic.GenericForeignKey` will look for. + .. attribute:: GenericForeignKey.for_concrete_model + + .. versionadded:: 1.6 + + If ``False``, the field will be able to reference proxy models. Default + is ``True``. This mirrors the ``for_concrete_model`` argument to + :meth:`~django.contrib.contenttypes.models.ContentTypeManager.get_for_model`. + + .. admonition:: Primary key type compatibility The "object_id" field doesn't have to be the same type as the @@ -492,7 +501,7 @@ 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, validate_max=False) +.. 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, validate_max=False, for_concrete_model=True) Returns a ``GenericInlineFormSet`` using :func:`~django.forms.models.modelformset_factory`. @@ -502,3 +511,9 @@ information. are similar to those documented in :func:`~django.forms.models.modelformset_factory` and :func:`~django.forms.models.inlineformset_factory`. + + .. versionadded:: 1.6 + + The ``for_concrete_model`` argument corresponds to the + :class:`~django.contrib.contenttypes.generic.GenericForeignKey.for_concrete_model` + argument on ``GenericForeignKey``. diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt index 5ee454d4f8..8d48381c06 100644 --- a/docs/releases/1.6.txt +++ b/docs/releases/1.6.txt @@ -261,6 +261,11 @@ Minor features * :class:`~django.views.generic.base.View` and :class:`~django.views.generic.base.RedirectView` now support HTTP PATCH method. +* :class:`GenericForeignKey <django.contrib.contenttypes.generic.GenericForeignKey>` + now takes an optional ``for_concrete_model`` argument, which when set to + ``False`` allows the field to reference proxy models. The default is ``True`` + to retain the old behavior. + Backwards incompatible changes in 1.6 ===================================== |
