Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 authored August 01, 2008

Showing 1 changed file with 19 additions and 1 deletion. Show diff stats Hide diff stats

  1. 20  docs/admin.txt
20  docs/admin.txt
@@ -421,7 +421,10 @@ overhead of having to select all the related instances to display in the
421 421
 drop-down.
422 422
 
423 423
 ``raw_id_fields`` is a list of fields you would like to change
424  
-into a ``Input`` widget for the primary key.
  424
+into a ``Input`` widget for either a ``ForeignKey`` or ``ManyToManyField``::
  425
+
  426
+    class ArticleAdmin(admin.ModelAdmin):
  427
+        raw_id_fields = ("newspaper",)
425 428
 
426 429
 ``save_as``
427 430
 ~~~~~~~~~~~
@@ -598,6 +601,21 @@ enough. See `max_num in formsets`_ for more information.
598 601
 
599 602
 .. _max_num in formsets: ../modelforms/#limiting-the-number-of-objects-editable
600 603
 
  604
+``raw_id_fields``
  605
+~~~~~~~~~~~~~~~~~
  606
+
  607
+By default, Django's admin uses a select-box interface (<select>) for
  608
+fields that are ``ForeignKey``. Sometimes you don't want to incur the
  609
+overhead of having to select all the related instances to display in the
  610
+drop-down.
  611
+
  612
+``raw_id_fields`` is a list of fields you would like to change
  613
+into a ``Input`` widget for either a ``ForeignKey`` or ``ManyToManyField``::
  614
+
  615
+    class BookInline(admin.TabularInline):
  616
+        model = Book
  617
+        raw_id_fields = ("pages",)
  618
+
601 619
 ``template``
602 620
 ~~~~~~~~~~~~
603 621
 

0 notes on commit 2904c1d

Please sign in to comment.
Something went wrong with that request. Please try again.