diff options
| author | Brian Rosner <brosner@gmail.com> | 2008-06-17 22:45:59 +0000 |
|---|---|---|
| committer | Brian Rosner <brosner@gmail.com> | 2008-06-17 22:45:59 +0000 |
| commit | de2f3900cf3c7e15b7cfe8150f65a16bbc3fab6c (patch) | |
| tree | d490751e6b27f1b716db092153b4127c61f9ebc5 /docs | |
| parent | 236a9dbd3c1785ffa926766c2826c6a12143d4f9 (diff) | |
newforms-admin: Brought docs/admin.txt up to speed on missing options from ModelAdmin.
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7684 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/admin.txt | 40 | ||||
| -rw-r--r-- | docs/model-api.txt | 12 |
2 files changed, 40 insertions, 12 deletions
diff --git a/docs/admin.txt b/docs/admin.txt index e63131c7b9..996930fc2b 100644 --- a/docs/admin.txt +++ b/docs/admin.txt @@ -146,6 +146,20 @@ The ``field_options`` dictionary can have the following keys: under the heading of the fieldset. It's used verbatim, so you can use any HTML and you must escape any special HTML characters (such as ampersands) yourself. +``filter_horizontal`` +~~~~~~~~~~~~~~~~~~~~~ + +Use a nifty unobtrusive Javascript "filter" interface instead of the +usability-challenged ``<select multiple>`` in the admin form. The value is a +list of fields that should be displayed as a horizontal filter interface. See +``filter_vertical`` to use a vertical interface. + +``filter_vertical`` +~~~~~~~~~~~~~~~~~~~ + +Same as ``filter_horizontal``, but is a vertical display of the filter +interface. + ``list_display`` ~~~~~~~~~~~~~~~~ @@ -341,6 +355,21 @@ ordered. This should be a list or tuple in the same format as a model's If this isn't provided, the Django admin will use the model's default ordering. +``prepopulated_fields`` +~~~~~~~~~~~~~~~~~~~~~~~ + +Set ``prepopulated_fields`` to a dictionary mapping field names to the fields +it should prepopulate from:: + + class ArticleAdmin(admin.ModelAdmin): + prepopulated_fields = {"slug": ("title",)} + +When set the given fields will use a bit of Javascript to populate from the +fields assigned. + +``prepopulated_fields`` doesn't accept DateTimeFields, ForeignKeys nor +ManyToManyFields. + ``radio_fields`` ~~~~~~~~~~~~~~~~ @@ -358,6 +387,17 @@ You have the choice of using ``HORIZONTAL`` or ``VERTICAL`` from the Don't include a field in ``radio_fields`` unless it's a ``ForeignKey`` or has ``choices`` set. +``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 the primary key. + ``save_as`` ~~~~~~~~~~~ diff --git a/docs/model-api.txt b/docs/model-api.txt index 2c497b30c2..d459b8638b 100644 --- a/docs/model-api.txt +++ b/docs/model-api.txt @@ -423,18 +423,6 @@ not specified, Django will use a default length of 50. Implies ``db_index=True``. -Accepts an extra option, ``prepopulate_from``, which is a list of fields -from which to auto-populate the slug, via JavaScript, in the object's admin -form:: - - models.SlugField(prepopulate_from=("pre_name", "name")) - -``prepopulate_from`` doesn't accept DateTimeFields, ForeignKeys nor -ManyToManyFields. - -The admin represents ``SlugField`` as an ``<input type="text">`` (a -single-line input). - ``SmallIntegerField`` ~~~~~~~~~~~~~~~~~~~~~ |
