0
0
mirror of https://github.com/django/django.git synced 2024-11-30 07:06:18 +01:00

Clarified the intermediary models admin documentation and a minor clean-up.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8209 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner 2008-08-04 19:37:47 +00:00
parent ac69520890
commit 40cd410955

View File

@ -691,7 +691,7 @@ Working with Many-to-Many Intermediary Models
----------------------------------------------
By default, admin widgets for many-to-many relations will be displayed inline
on whichever model contains the actual reference to the `ManyToManyField`.
on whichever model contains the actual reference to the ``ManyToManyField``.
However, when you specify an intermediary model using the ``through``
argument to a ``ManyToManyField``, the admin will not display a widget by
default. This is because each instance of that intermediary model requires
@ -716,15 +716,15 @@ models::
invite_reason = models.CharField(max_length=64)
The first step in displaying this intermediate model in the admin is to
define an inline model for the Membership table::
define an inline class for the ``Membership`` model::
class MembershipInline(admin.TabularInline):
model = Membership
extra = 1
This simple example uses the defaults inline form for the Membership model,
and shows 1 extra line. This could be customized using any of the options
available to inline models.
This simple example uses the default ``InlineModelAdmin`` values for the
``Membership`` model, and limits the extra add forms to one. This could be
customized using any of the options available to ``InlineModelAdmin`` classes.
Now create admin views for the ``Person`` and ``Group`` models::
@ -739,8 +739,8 @@ Finally, register your ``Person`` and ``Group`` models with the admin site::
admin.site.register(Person, PersonAdmin)
admin.site.register(Group, GroupAdmin)
Now your admin site is set up to edit ``Membership`` objects inline from either
the ``Person`` or the ``Group`` detail pages.
Now your admin site is set up to edit ``Membership`` objects inline from
either the ``Person`` or the ``Group`` detail pages.
``AdminSite`` objects
=====================