mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
[1.2.X] Fixed #13307 -- Enhanced the generic inlines documentation by mentioning the concrete Generic{Tabular,Stacked}Inline classes that should be used. Thanks loki77 for the report.
Backport of [15124] from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15125 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1287,6 +1287,8 @@ Finally, register your ``Person`` and ``Group`` models with the admin site::
|
||||
Now your admin site is set up to edit ``Membership`` objects inline from
|
||||
either the ``Person`` or the ``Group`` detail pages.
|
||||
|
||||
.. _using-generic-relations-as-an-inline:
|
||||
|
||||
Using generic relations as an inline
|
||||
------------------------------------
|
||||
|
||||
@@ -1303,9 +1305,12 @@ you have the following models::
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
If you want to allow editing and creating ``Image`` instance on the ``Product``
|
||||
add/change views you can simply use ``GenericInlineModelAdmin`` provided by
|
||||
``django.contrib.contenttypes.generic``. In your ``admin.py`` for this
|
||||
example app::
|
||||
add/change views you can use ``GenericTabularInline`` or
|
||||
``GenericStackedInline`` (both subclasses of ``GenericInlineModelAdmin``)
|
||||
provided by ``django.contrib.contenttypes.generic``, they implement tabular and
|
||||
stacked visual layouts for the forms representing the inline objects
|
||||
respectively just like their non-generic counterparts and behave just like any
|
||||
other inline. In your ``admin.py`` for this example app::
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib.contenttypes import generic
|
||||
@@ -1322,10 +1327,8 @@ example app::
|
||||
|
||||
admin.site.register(Product, ProductAdmin)
|
||||
|
||||
``django.contrib.contenttypes.generic`` provides both a ``GenericTabularInline``
|
||||
and ``GenericStackedInline`` and behave just like any other inline. See the
|
||||
:doc:`contenttypes documentation </ref/contrib/contenttypes>` for more specific
|
||||
information.
|
||||
See the :doc:`contenttypes documentation </ref/contrib/contenttypes>` for more
|
||||
specific information.
|
||||
|
||||
Overriding Admin Templates
|
||||
==========================
|
||||
|
||||
Reference in New Issue
Block a user