1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

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
This commit is contained in:
Brian Rosner 2008-06-17 22:45:59 +00:00
parent 236a9dbd3c
commit de2f3900cf
2 changed files with 40 additions and 12 deletions

View File

@ -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 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. 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`` ``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. 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`` ``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 Don't include a field in ``radio_fields`` unless it's a ``ForeignKey`` or has
``choices`` set. ``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`` ``save_as``
~~~~~~~~~~~ ~~~~~~~~~~~

View File

@ -423,18 +423,6 @@ not specified, Django will use a default length of 50.
Implies ``db_index=True``. 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`` ``SmallIntegerField``
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~