Commit 2904c1d4 authored by Brian Rosner's avatar Brian Rosner
Browse files

Clarified the raw_id_fields documentation and added it to InlineModelAdmin...

Clarified the raw_id_fields documentation and added it to InlineModelAdmin options section. Added examples as well. Fixes #7905. Thanks Matthew Flanagan for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8176 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent e7508a45
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -421,7 +421,10 @@ overhead of having to select all the related instances to display in the
drop-down.

``raw_id_fields`` is a list of fields you would like to change
into a ``Input`` widget for the primary key.
into a ``Input`` widget for either a ``ForeignKey`` or ``ManyToManyField``::

    class ArticleAdmin(admin.ModelAdmin):
        raw_id_fields = ("newspaper",)

``save_as``
~~~~~~~~~~~
@@ -598,6 +601,21 @@ enough. See `max_num in formsets`_ for more information.

.. _max_num in formsets: ../modelforms/#limiting-the-number-of-objects-editable

``raw_id_fields``
~~~~~~~~~~~~~~~~~

By default, Django's admin uses a select-box interface (<select>) for
fields that are ``ForeignKey``. Sometimes you don't want to incur the
overhead of having to select all the related instances to display in the
drop-down.

``raw_id_fields`` is a list of fields you would like to change
into a ``Input`` widget for either a ``ForeignKey`` or ``ManyToManyField``::

    class BookInline(admin.TabularInline):
        model = Book
        raw_id_fields = ("pages",)

``template``
~~~~~~~~~~~~