Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clarified the raw_id_fields documentation and added it to InlineModel…

…Admin 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
  • Loading branch information...
commit 2904c1d4b33fb4612291db9d46fff56842854e58 1 parent e7508a4
Brian Rosner brosner authored
Showing with 19 additions and 1 deletion.
  1. +19 −1 docs/admin.txt
20 docs/admin.txt
View
@@ -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``
~~~~~~~~~~~~
Please sign in to comment.
Something went wrong with that request. Please try again.